ILE COBOL Programmer's Guide

Extra Positions for Displayable Symbols (Numeric Editing)

You can also define numeric items with certain editing symbols (such as decimal points, commas, and dollar signs) to make the data easier to read and understand when displayed or printed on reports. For example:

05 PRICE           PIC   9(5)V99.
05 EDITED-PRICE    PIC  $ZZ,ZZ9V99.
   .
   .
   .
   MOVE PRICE to EDITED-PRICE
   DISPLAY EDITED-PRICE

If the contents of PRICE were 0150099 (representing the value 1,500.99), then $ 1,500.99 would be displayed after the code is run.

How to Use Numeric-Edited Items as Numbers

Numeric-edited items are classified as alphanumeric data items, not as numbers. Therefore, they cannot be operands in arithmetic expressions or ADD, SUBTRACT, MULTIPLY, DIVIDE, and COMPUTE statements.

Numeric-edited items can be moved to numeric and numeric-edited items. In the following example, the numeric-edited item is de-edited, and its numeric value is moved to the numeric data item.

MOVE EDITED-PRICE to PRICE.
DISPLAY PRICE.

If these two statements were to immediately follow the statements shown in the previous example, then PRICE would be displayed as 0150099, representing the value 1,500.99.

Numeric-edited items can also be associated with a locale. When a MOVE is made to a numeric-edited item that is based on a locale, the result is edited according to that locale. The CCSID associated with a locale also affects the edited result, and when a program is run, the CCSIDs associated with the files, locales, and numeric-edited items used by a program are compared to see if conversion is necessary. For more information about how CCSIDs are treated at runtime, refer to Runtime CCSID Considerations.

For complete information on the data descriptions for numeric data, refer to WebSphere Development Studio: ILE COBOL Reference.


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