Packed-decimal-integer encoding on IBM® i

Valid values for packed-decimal-integer encoding

The following values are valid for the packed-decimal-integer encoding:

    ENDUND
    Undefined packed-decimal encoding.

    Packed-decimal integers are represented using an encoding that is undefined.

    ENDNOR
    Normal packed-decimal encoding. Packed-decimal integers are represented in the conventional way:

    • Each decimal digit in the printable form of the number is represented in packed decimal by a single hexadecimal digit in the range X'0' through X'9'. Each hexadecimal digit occupies 4 bits, and so each byte in the packed decimal number represents two decimal digits in the printable form of the number.
    • The least significant byte in the packed-decimal number is the byte which contains the least significant decimal digit. Within that byte, the most significant 4 bits contain the least significant decimal digit, and the least significant 4 bits contain the sign. The sign is either X'C' (positive), X'D' (negative), or X'F' (unsigned).
    • The least significant byte in the number has the highest address of any of the bytes in the number; the most significant byte has the lowest address.
    • The least significant bit in each byte is next to the byte with the next higher address; the most significant bit in each byte is next to the byte with the next lower address.

    ENDREV
    Reversed packed-decimal encoding.

    Packed-decimal integers are represented in the same way as ENDNOR, but with the bytes arranged in reverse order. The bits within each byte are arranged in the same way as ENDNOR.