Definition Attributes
Data Definition Language (DDL) Reference Manual — 426798-002
6- 25
OCCURS DEPENDING ON Clause
OCCURS DEPENDING ON Clause Guidelines
The guidelines for using an OCCURS clause also apply to OCCURS DEPENDING
ON, with the following exceptions:
•
For C, FORTRAN, Pascal, pTAL, TACL, and TAL, the DDL compiler generates
source code identical to the code it generates for OCCURS
max
TIMES.
•
Only one OCCURS DEPENDING ON clause can be in a DEFINITION or RECORD
statement, and the clause’s subordinate fields or groups must be the last fields or
groups in that statement.
•
OCCURS DEPENDING ON clauses cannot be nested; however, a subordinate
field or group can have an OCCURS clause.
•
COBOL output for the INDEXED BY attribute is the direct translation of the
attribute.
•
If you specify an index name in the OCCURS clause, you should not specify
USAGE IS INDEX for the field of that name, because COBOL requires that all
index names be unique throughout a program. DDL checks for the uniqueness of
an index name you specify in the INDEXED BY attribute.
OCCURS DEPENDING ON Clause Example
In the following example, the number of occurrences of DEP-NAME depends on the
value of NUM-DEP:
DEF name.
02 last-name PIC X(12).
02 first-name PIC X(8).
02 midinit PIC X(2).
END
DEF addr.
02 address PIC X(22).
02 city PIC X(14).
02 state PIC X(2).
02 zip PIC 9(5).
END
DEF employee.
02 emp-name TYPE name.
02 emp-addr TYPE addr.
02 num-dep TYPE BINARY 16 MUST BE 0 THRU 12.
02 dep-name TYPE name
OCCURS 0 TO 12 TIMES
DEPENDING ON num-dep.
END
NUM-DEP must contain a positive integer value.
Содержание DDL D40
Страница 36: ...Introduction to DDL Data Definition Language DDL Reference Manual 426798 002 1 14 Examining a Dictionary ...
Страница 66: ...Named Constants Data Definition Language DDL Reference Manual 426798 002 4 10 Standard SPI Constants ...
Страница 230: ...Dictionary Manipulation Statements Data Definition Language DDL Reference Manual 426798 002 8 14 SHOW USE OF Statement ...
Страница 370: ...Dictionary Maintenance Data Definition Language DDL Reference Manual 426798 002 10 24 Converting a Dictionary ...
Страница 456: ...Sample Schemas Data Definition Language DDL Reference Manual 426798 002 B 12 ASSNDDL Statements ...
Страница 470: ...DDL Data Translation Data Definition Language DDL Reference Manual 426798 002 C 14 ...
Страница 528: ...Dictionary Reports Data Definition Language DDL Reference Manual 426798 002 E 8 Requesting Reports ...
Страница 552: ...DDL Alignment Rules Data Definition Language DDL Reference Manual 426798 002 H 4 FIELDALIGN_SHARED8 Alignment Rules ...
Страница 576: ...Index Data Definition Language DDL Reference Manual 426798 002 Index 22 Special Characters ...