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-decimal 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 length of the field from 1 to 16 bytes.


Top of page

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

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, the value is rounded to the nearest whole number.

length

Numeric

Is the number of bytes in the output_format, from 1 to 16.

output_format

Alphanumeric

This 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