ILE COBOL Programmer's Guide

Defining Numeric Items

You define numeric items using the character "9" in the data description to represent the decimal digits of the number, instead of using an "X" as is done for alphanumeric items:

05  COUNT-X         PIC 9(4)   VALUE 25.
05  CUSTOMER-NAME   PIC X(20)  VALUE "Johnson".

You can code up to 18 digits in the PICTURE clause, as well as various other characters of special significance. The "S" in the following example makes the value signed.

05  PRICE           PIC S99V99.

The field can hold a positive or negative value. The "V" indicates the position of an implied decimal point. Neither "S" nor "V" are counted in the size of the item, nor do they require extra storage positions, unless the item is coded as USAGE DISPLAY with the SIGN IS SEPARATE clause. An exception is internal floating-point data (COMP-1 and COMP-2), for which there is no PICTURE clause. For example, an internal floating point data item is defined as follows:

05  GROMMET-SIZE-DEVIATION    USAGE COMP-1    VALUE 02.35E-5

For information on how you can control how the compiler handles floating-point data items, refer to the description of *FLOAT and *NOFLOAT under CVTOPT Parameter and in Using the PROCESS Statement to Specify Compiler Options.


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