Data Definition Language (DDL) Reference Manual

Definition Attributes
Data Definition Language (DDL) Reference Manual529431-004
6-74
USAGE
You cannot specify a USAGE clause for a national data item.
A field can be declared as COMP-3 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 clause for an item
declared as COMP-3.
When a group is declared as COMP-3, each member is also COMP-3. All elements of
the group must have a PICTURE declaration compatible with COMP-3.
A COMP-3 item can refer to another item (TYPE * or TYPE def-name ) provided the
referenced item has been declared as COMP-3. If the referenced definition is a group
item, then either the item itself or all of its constituent elements must have been
declared as COMP-3.
The number of bytes required by a data item that has been declared with USAGE as
COMP-3, COMPUTATIONAL-3, or PACKED-DECIMAL, depends upon the number of
9s specified in the picture clause of that item.
When a DDL item contains any PACKED-DECIMAL field (declared with a USAGE
clause COMP-3, COMPUTATIONAL-3, or PACKED-DECIMAL value), then DDL only
supports the generation of output for COBOL.
Although source code can be produced for computational items in each language,
problems can occur when data is stored in such items. Consider a field described as:
PIC 9(7) COMP.
A COBOL program can enter only 7 digits in the field, but a TAL program can enter a
much larger value in the INT(32) field generated from the description. Problems can
occur if this larger value is accessed by the COBOL program.
You can avoid such problems in COBOL by using TYPE BINARY n, instead of PIC and
COMP, in the DDL source code. A BINARY data type translates to a COBOL NATIVE-
2, NATIVE-4, or NATIVE-8 data type.
Example 6-60
on page 6-75 shows the COBOL output that the DDL compiler
generates for fields defined with USAGE IS INDEX. Error messages result when the
size of the field definition or description does not match the storage allocation for index
names in the target language.