Read Hex Values in COBOL
Posted on 2008-06-23
I have a requirement in which, i need to find out the ASCII equivalent of a given character. To explain this with an example, if a character "L" is passed to my program, i need to return back 76 (Decimal equivalent of L in ASCII). I was able to convert the EBCDIC character "L" to the ASCII hex value of "L" i.e. "4C". Now, i need to read the hex value of "4C' in my COBOL program and then convert that to 76 using the hexadecimal to decimal conversion.
Can anyone please advise how i can read each character of the hex value and convert it to a decimal equivalent. I need to do a (4 *16^1) + (C * 16^0)?