ILE COBOL Programmer's Guide

External Decimal (USAGE DISPLAY) Items

When you code USAGE DISPLAY or omit the USAGE clause, each position (or byte) of storage contains one decimal digit. This corresponds to the format used for printing or displaying output, meaning that the items are stored in displayable form.

What USAGE DISPLAY Items Are For

External decimal items are primarily intended for receiving and sending numbers between your program and files, terminal, and printers. However, it is also acceptable to use external decimal items as operands and receivers in your program's arithmetic processing, and it is often convenient to program this way.

Should You Use Them for Arithmetic

If your program performs a lot of intensive arithmetic and efficiency is a high priority, you might want to use one of ILE COBOL's computational numeric data types for the data items used in the arithmetic.

The computer has to automatically convert displayable numbers to the internal representation of their numeric value before they can be used in arithmetic operations. Therefore, it is often more efficient to define your data items as computational items to begin with, rather than as DISPLAY items. For example:

05 COUNT-X          PIC S9V9(5)   USAGE COMP   VALUE 3.14159.


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