kwolbert_IT
asked on
COBOL
Does anyone know how to convert the ASCII letter 'A' to the Ascii value 65?
I would like to perform a calculation on the value of the letters entered without using evaluate of nested if statements. I used to do this in Microfocus cobol using some sort of valueof statement.
I would like to perform a calculation on the value of the letters entered without using evaluate of nested if statements. I used to do this in Microfocus cobol using some sort of valueof statement.
ASKER
No I didn't try a redefine but I have now. It returns a value of 40 no matter what.
I attempted the same moving from pic x to pic 99 before and that didn't work. Also 99 binary, s99, etc, etc, etc. This shouldn't be complicated but for some reason I can't do it. I remember doing this in Microfocus years ago and the coding escapes me. It's a different language but why would Fujitisu incorporate that into it's abilities.
Someday someone will look at my evaluate and post my code on thedailywtf.com.
I attempted the same moving from pic x to pic 99 before and that didn't work. Also 99 binary, s99, etc, etc, etc. This shouldn't be complicated but for some reason I can't do it. I remember doing this in Microfocus years ago and the coding escapes me. It's a different language but why would Fujitisu incorporate that into it's abilities.
Someday someone will look at my evaluate and post my code on thedailywtf.com.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
01 conversion-area.
02 ca-char pic x.
02 ca-int redefines ca-char BINARY-CHAR UNSIGNED.
Worked like a charm!!!
02 ca-char pic x.
02 ca-int redefines ca-char BINARY-CHAR UNSIGNED.
Worked like a charm!!!
Excellent, glad I tossed that out there. Thanks for the grade.
~bp
~bp
01 conversion-area.
02 ca-char picture x.
02 ca-int redefines ca-char picture s9(2) binary.
Then just move the character to "convert" into the ca-char area, and get it's ascii value from ca-int.
~bp