OCCURS(numeric_constant)

The OCCURS keyword allows the specification of the number of occurrences of a multiple-occurrence data structure.

The numeric_constant parameter must be a value greater than 0 with no decimal positions. It can be a numeric literal, a built-in function returning a numeric value, or a numeric constant.

The constant value does not need to be known at the time the keyword is processed, but the value must be known at compile-time.

This keyword is not valid for a program status data structure, a file information data structure, or a data area data structure.

If a multiple occurrence data structure contains pointer subfields, the distance between occurrences must be an exact multiple of 16 because of system storage restrictions for pointers. This means that the distance between occurrences may be greater than the length of each occurrence.

The following is an example showing the storage allocation of a multiple occurrence data structure with pointer subfields.

Figure 137. Storage Allocation of Multiple Occurrence Data Structure with Pointer Subfields
*.. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... *
DName+++++++++++ETDsFrom+++To/L+++IDc.Keywords+++++++++++++++++++++++++++++
D DS1             DS                  OCCURS(2)
D   POINTER                     16*
D   FLD5                         5
D DS2             DS                  OCCURS(2)
D   CHAR16                      16
D   CHR5                         5

Allocation of fields in storage. The occurrences of DS1 are 32 bytes apart, while the occurrences of DS2 are 21 bytes apart.

REQTEXT


[ Top of Page | Previous Page | Next Page | Contents | Index ]