in reply to Perl Unpack Cobol Binary File and Fields
See: https://www.ibm.com/support/knowledgecenter/en/SS6SG3_4.2.0/com.ibm.entcobol.doc_4.2/PGandLR/concepts/cpari09.htm
PACKED-DECIMAL and COMP-3 are synonyms. Packed-decimal items occupy 1 byte of storage for every two decimal digits you code in the PICTURE description, except that the rightmost byte contains only one digit and the sign. This format is most efficient when you code an odd number of digits in the PICTURE description, so that the leftmost byte is fully used. Packed-decimal items are handled as fixed-point numbers for arithmetic purposes.
The digits are stored left-to-right as decimal numbers, two digits per byte. The rightmost nybble is a sign indicator ... unless SIGN IS SEPARATE.
https://www.ibm.com/support/knowledgecenter/en/SS6SG3_4.2.0/com.ibm.entcobol.doc_4.2/PGandLR/ref/rpari25.htm
Positive can be $C, $A, $E, $F; negative can be $D, $B. So the numeric value -(0)123 might be $000102030B.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl Unpack Cobol Binary File and Fields
by Anonymous Monk on May 06, 2020 at 13:33 UTC | |
| |
|
Re^2: Perl Unpack Cobol Binary File and Fields
by Anonymous Monk on May 04, 2020 at 22:01 UTC |