Definition Attributes
Data Definition Language (DDL) Reference Manual — 426798-002
6- 75
USAGE Clause
02 F1 PIC 9999 COMP-3
VALUE 1234.
COBOL output produced for EMP.
For the PACKED-DECIMAL data type and a PICTURE 9999 declaration, the
1234 would be stored as follows:
0 1 2 3 4 F (sign)
------------------ -------------------- -----------------
| 0000 | 00001 | | 0010 | 0011 | | 0100 | 1111 |
------------------ -------------------- -----------------
One BYTE One BYTE One BYTE
PACKED-DECIMAL
Specifies that the field or group is a numeric item that is stored in decimal form, but
one digit takes one-half byte. The sign is stored separately as the rightmost half
byte, regardless of whether S is specified in the PICTURE declaration.
DDL supports this data type to generate COBOL output only. Languages other
than COBOL do not support PACKED-DECIMAL or its equivalent data types. Any
attempt to generate output for the PACKED-DECIMAL data type in languages
other than COBOL cause DDL to issue error messages.
USAGE Clause Guidelines
The following points are guidelines for using the USAGE clause:
•
All fields declared as TYPE BINARY are COMPUTATIONAL items by default.
•
A field can be declared as COMPUTATIONAL if the associated PICTURE
declaration is of the form:
PIC [ S ] 9 ... [ (length) ] [ V 9 ... [ (length) ] ]
•
The symbol 9 can occur a maximum of 18 times in a picture for an item declared
as COMPUTATIONAL. If the symbol 9 occurs more than 10 times, the picture must
contain the symbol S.
•
When a group is declared as COMPUTATIONAL, each member of the group is
also COMPUTATIONAL. All elements of the group must either be declared TYPE
BINARY or have a picture compatible with TYPE BINARY. Reference definitions
(TYPE * or TYPE
def-name
) are accepted if they refer to an element declared as
COMPUTATIONAL or TYPE BINARY.