ITOPACK: Converting a Large Binary Integer to Packed-Decimal Format

How to:

The ITOPACK function converts a large binary integer in a non-FOCUS data source to packed-decimal format.

This is useful for some programming languages and some non-FOCUS data storage systems that use special long integers, which do not fit the regular integer format (four bytes in length) supported in the synonym, and, therefore, require conversion to packed-decimal format.

You must specify how many of the right-most bytes in the input field are significant. The result is an 8-byte packed-decimal field of up to 15 significant numeric positions (for example, P15 or P16.2).

Limit: For a field defined as 'PIC 9(15) COMP' or the equivalent (15 significant digits), the maximum number that can be converted is 167,744,242,712,576.


Top of page

x
Syntax: How to Convert a Large Binary Integer to Packed-Decimal Format
ITOPACK(maxbytes, infield, output)

where:

maxbytes

Numeric

Is the maximum number of bytes in the 8-byte input field that have significant numeric data, including the binary sign.

Valid values are:

  • 5 ignores the left-most 3 bytes (up to 11 significant positions).
  • 6 ignores the left-most 2 bytes (up to 14 significant positions).
  • 7 ignores the left-most byte (up to 15 significant positions).
infield

A8

Is the field that contains the binary number. Both the USAGE and ACTUAL formats of the field must be A8.

output

Numeric

The format must be Pn or Pn.d.



Example: Converting a Large Binary Integer to Packed-Decimal Format

ITOPACK converts BINARYFLD to packed-decimal format.

ITOPACK(6, BINARYFLD, 'P14.4')

iWay Software