Convert 1 byte (binary?) to char in Cobol



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Convert 1 byte (binary?) to char in Cobol

Postby LasseH » Thu Feb 20, 2014 2:44 pm

Don't know if the subject is correct, but...

Trying to display the content in 2 fields with this content

1---5----0----5
004441....
110000....


I want to be able to display byte 1-2 as 0101 and byte 6 as 10 (not 257 and 16)
These fields are now defined as A PIC XX and B PIC X

//Lasse
LasseH
 
Posts: 70
Joined: Mon Nov 08, 2010 2:51 pm
Has thanked: 7 times
Been thanked: 1 time

Re: Convert 1 byte (binary?) to char in Cobol

Postby NicC » Thu Feb 20, 2014 3:27 pm

You have been around long enough to know that you should have used the code tags to preserve the layout. I have coded it for you.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: Convert 1 byte (binary?) to char in Cobol

Postby BillyBoyo » Thu Feb 20, 2014 5:41 pm

BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Convert 1 byte (binary?) to char in Cobol

Postby LasseH » Thu Feb 20, 2014 7:34 pm

Thnx NicC
Did the job BillyBoyo, thnx
LasseH
 
Posts: 70
Joined: Mon Nov 08, 2010 2:51 pm
Has thanked: 7 times
Been thanked: 1 time


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post