Definition Attributes
Data Definition Language (DDL) Reference Manual — 426798-002
6- 24
OCCURS DEPENDING ON Clause
03 year PIC 99.
END
The following shows COBOL output for the INDEXED BY attribute:
OCCURS DEPENDING ON Clause
The OCCURS DEPENDING ON clause declares a field or group that is repeated a
variable number of times depending on the current value of an integer variable.
DDL uses only the maximum value of the OCCURS DEPENDING ON clause when
generating C, FORTRAN, Pascal, pTAL, TACL, or TAL source code.
min
is the least number of times the field or group can be repeated. You can specify
min
as an integer between 0 and 32,767 or as the name of a constant in an open
DDL dictionary. The constant value must be an integer between 0 and 32,767.
max
is the greatest number of times the field or group can be repeated. You can specify
max
as a positive integer greater than or equal to
min
or as the name of a
constant in an open DDL dictionary. The constant value must be a positive integer
greater than or equal to
min
.
field-name
identifies an existing field within the same definition and with a numeric data type; it
must contain a positive integer value to specify the number of repetitions.
INDEXED BY index-name
specifies the index attribute for COBOL output only;
index-name
is the name of a
field to use as an index. The maximum length of the index name is 30 ASCII
characters.
DDL Code
COBOL Code
DEF xyz
02 abc TYPE BINARY
OCCURS 3 TIMES
INDEXED BY ix.
END.
01 XYZ.
02 ABC NATIVE-2
OCCURS 3 TIMES
INDEXED BY IX.
OCCURS min TO max TIMES DEPENDING ON field-name
[INDEXED BY index-name]