Rational Developer for System z
Enterprise COBOL for z/OS, Version 4.1, Programming Guide


Controlling how numeric data is stored

You can control how the computer stores numeric data items by coding the USAGE clause in your data description entries.

You might want to control the format for any of several reasons such as these:

The numeric data you use in your program will have one of the following formats available with COBOL:

COMP and COMP-4 are synonymous with BINARY, and COMP-3 is synonymous with PACKED-DECIMAL.

The compiler converts displayable numbers to the internal representation of their numeric values before using them in arithmetic operations. Therefore it is often more efficient if you define data items as BINARY or PACKED-DECIMAL than as DISPLAY or NATIONAL. For example:

05  Initial-count   Pic S9(4)  Usage Binary   Value 1000.

Regardless of which USAGE clause you use to control the internal representation of a value, you use the same PICTURE clause conventions and decimal value in the VALUE clause (except for internal floating-point data, for which you cannot use a PICTURE clause).

Examples: numeric data and internal representation


Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)