Convert from EBCDIC to HEX



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

Convert from EBCDIC to HEX

Postby rsrn333 » Mon Mar 28, 2016 6:13 pm

is there a way to convert from EBCDIC to HEX?

this is to be used in AFP file which is in HEX format.

we have to add a value to the BNG records in AFP(which denotes a start of a transaction in a file).

to do that we are running a counter variable (in decimal format) each time the BNG record is encountered in the AFP fule. from here we need to take the generated value as an EBCDIC code and convert it to its equivalent HEX code. EX:

EBCDIC     HEX
0          F0
1          F1
2          F2
etc...

the HEX values have to be populated into the AFP file.
Coded
rsrn333
 
Posts: 1
Joined: Mon Mar 28, 2016 5:44 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Convert from EBCDIC to HEX

Postby Robert Sample » Mon Mar 28, 2016 6:34 pm

Are you saying you want the 1-character value 0 to be replaced by the 2-character value F0? Because EBCDIC is already in hexadecimal (which is just a shortcut to refer to binary values which means ASCII can be considered hexadecimal as can UTF-8, UTF-16, etc), so your post doesn't make sense otherwise.
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: Convert from EBCDIC to HEX

Postby Terry Heinze » Mon Mar 28, 2016 6:57 pm

rsrn333,
In the future, please use code tags to preserve correct spacing.
.... Terry
Terry Heinze
 
Posts: 239
Joined: Wed Dec 04, 2013 11:08 pm
Location: Richfield, MN, USA
Has thanked: 12 times
Been thanked: 11 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post