Data Transformation Engine Functions and Expressions Reference Guide
Chapter 3 - Function Reference PACK
Functions and Expressions Reference Guide
161
PACK
The PACK function converts an integer to a text item that can be interpreted as a
packed decimal number.
The sign values for packed data are as follows:
♦ C for positive (+)
♦ D for negative (-)
♦ F for unsigned, which is read as positive
Syntax
PACK (single-integer-expression)
Meaning
PACK (integer_to_conver)
Returns
This function returns a single-text-item.
In a packed decimal number, each half-byte is a digit, except for the last half-
byte of the rightmost byte, which contains a sign.
Examples
PACK (314) returns “1L”
results in the hex value 31 4C, which, in ASCII, looks like 1L.
PACK ((Unit Price * Quantity) * 100)
In this example, the packed number has two implied decimal places. Because
PACK does not accept decimal places, including implied ones, the nested
arithmetic expression, Unit Price * Quantity, is multiplied by 100 before
rounding.
Uses
Use
PACK to convert an integer to a text item that can be interpreted as a
packed decimal number.