Data Definition Language (DDL) Reference Manual
Definition Attributes
Data Definition Language (DDL) Reference Manual—529431-004
6-22
OCCURS
In Example 6-17 on page 6-22, which declares storage for 52 paycheck values, one for
each week of the year:
•
TAL programs with TALBOUND 1 or with no TALBOUND clause access individual
paycheck values like this:
•
TAL programs with TALBOUND 0 access individual paycheck values like this:
To refer to an individual field within a group, follow the field name with a subscript. For
example, to refer to the tenth month within the dates group in Example 6-18 on
page 6-22, a COBOL program uses the subscript 10:
month(10)
PAYCHECK [1] Paycheck value for the first week
PAYCHECK [52] Paycheck value for the last week
PAYCHECK [0] Paycheck value for the first week
PAYCHECK [51] Paycheck value for the last week
Example 6-17. OCCURS Clause
DEF salary.
02 paycheck PIC 9999V99
OCCURS 52 TIMES.
END
Example 6-18. Repeating a Group With an OCCURS Clause
DEF paydate.
02 dates OCCURS 12 TIMES.
03 month PIC 99.
03 day PIC 99.
03 year PIC 99.
END
Example 6-19. Constant as OCCURS Value
CONSTANT pay-period VALUE IS 24.
DEF bi-monthly-paydate.
02 paydate OCCURS pay-period TIMES.
03 bi-month PIC 99.
03 day PIC 99.
03 year PIC 99.
END