How do I convert COBOL Comp-3 packed to ASCII?
I am receiving a flat file that has a few bytes in COBOL COmp-3 packed format.
I only need to read 6 bytes then unpack to convert to ASCII in 12 bytes.
The first byte will contain a
01
or
02
that will tell me if the number that follows should be considered negative or positive. The number is in the next five bytes and will translate to a number with one decimal position.
Samples:
01 00 00 02 22 22
02 00 00 03 33 33
So, I understand the first byte. But how do I read/convert the number
00022
?
I looked at Google and saw a few pages explaining ECBDIC but am no closer to a solution.
Any clues from the old timers out here that remember this arcane stuff?