PACKED( ) function

Returns numeric data converted to the Packed data type.

Syntax

PACKED(number, length_of_result)

Parameters

number

Numeric. The numeric value or field to convert.

length_of_result

Numeric. The number of bytes to use in the output string.

Output

Numeric.

Remarks

The Packed data type is used by mainframe operating systems to store numeric values in a format that uses minimal storage space. The Packed data type stores two digits in each byte, and the last byte indicates whether the value is positive or negative. You can use the PACKED( ) function to convert numeric data to the Packed format for export to mainframe systems.

If the length_of_result parameter value is shorter than the length of the number value, the additional digits are truncated.

Examples

The output of this function cannot be displayed in ACL. The Return value column below shows the value as it would be stored on a mainframe operating system.

Example Return value (hexadecimal)

PACKED(75, 3)

00075C

PACKED(7.5, 3)

00075C

PACKED(-12.456, 6)

00000012456D

PACKED(-12.456, 2)

456D

To create an 8-byte field containing each employee’s salary as a PACKED number for uploading to a mainframe, specify:

PACKED(SALARY, 8)



(C) 2013 ACL Services Ltd. All Rights Reserved. | Send feedback