Skip to main content

Hi, 

 

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

 

Thanks You. 

Hi, 

 

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

 

Thanks You. 

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.

Hi, 

 

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

 

Thanks You. 

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"