ILE COBOL Programmer's Guide

Binary (USAGE BINARY or COMP-4) Items

Binary format occupies 2, 4, or 8 bytes of storage, and is handled for arithmetic purposes as fixed-point number with the leftmost bit being the operational sign. For byte-reversed binary data, the sign bit is the leftmost bit of the rightmost byte.

How Much Storage BINARY Occupies

A PICTURE description with 4 or fewer decimal digits occupies 2 bytes; with 5 to 9 decimal digits, 4 bytes; with 10 to 18 decimal digits, 8 bytes.

Binary items are well suited for containing subscripts or reference modification start and length positions.

However, BINARY format is not as well suited for decimal alignment, so ILE COBOL converts BINARY numbers in arithmetic expressions to PACKED DECIMAL format. It is, therefore, preferable to use PACKED DECIMAL format for arithmetic expressions.

Using PACKED DECIMAL format over BINARY format is also preferable when converting numbers to display format. Converting a number from BINARY format to DISPLAY format is more difficult than converting a number from PACKED DECIMAL format to DISPLAY format.

Truncation of Binary Data (*STDTRUNC Compiler Option)

Use the *STDTRUNC and *NOSTDTRUNC compiler options (described in the "OPTION Parameter" on page OPTION Parameter). to indicate how BINARY and COMP-4 data is truncated.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]