Highlighted
Absent Member.
Absent Member.
1355 views

HOW TO CONVERT HEX VALUE TO ASCII

Hi, 

 

May i know that how can i convert the hex value to ascii value using cobol. 

 

Thanks You. 

0 Likes
2 Replies
Highlighted
Absent Member.
Absent Member.

RE: HOW TO CONVERT HEX VALUE TO ASCII

According to the documentation you can use "HEX2ASCII".

 

CALL "HEX2ASCII" 
USING ASCII-VALUE, HEX-VALUE

ASCII-VALUE PIC X(2)   The ASCII representation of a unit of data.
HEX-VALUE PIC X(4) The hexadecimal value.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: HOW TO CONVERT HEX VALUE TO ASCII

01 hexValue pic x(01).
01 decValue redefines hexValue pic 9(02) comp-x.

move x"41" to hexValue
now decValue should read 65 = x"41" = "A"
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.