PCKOUT: Writing a Packed Number of Variable Length

How to:

The PCKOUT function writes a packed-decimal number of variable length to an extract file. When a request saves a packed number to an extract file, it typically writes it as an 8- or 16-byte field regardless of its format specification. With PCKOUT, you can vary the field's length between 1 to 16 bytes.


Top of page

x
Syntax: How to Write a Packed Number of Variable Length
PCKOUT(in_value, length, output)

where:

in_value

Numeric

Is the input value. It can be in packed, integer, single- or double-precision floating point format. If it is not in integer format, it is rounded to the nearest whole number.

length

Numeric

Is the length of the output value, from 1 to 16 bytes.

output

Alphanumeric

The function returns the field as alphanumeric although it contains packed data.



Example: Writing a Packed Number of Variable Length

PCKOUT converts CURR_SAL to a five-byte packed format.

PCKOUT(CURR_SAL, 5, 'A5')

iWay Software