5.3.10.5 OCCURS DEPENDING ON Clause
The OCCURS DEPENDING ON clause specifies variable-length tables.
-
data-name-1
-
Specifies the object of the OCCURS DEPENDING ON clause; that is, the
data item whose current value represents the current number of
occurrences of the subject item. The contents of items whose
occurrence numbers exceed the value of the object are undefined.
The object of the OCCURS DEPENDING ON clause must describe an integer
X data item. The object cannot be a windowed date field.
The object of the OCCURS DEPENDING ON clause must not occupy any
storage position within the range of the table (that is, any storage
position from the first character position in the table through the
last character position in the table).
X The object of the OCCURS DEPENDING ON clause may not be variably
X located; the object cannot follow an item that contains an OCCURS
X DEPENDING ON clause.
If the OCCURS clause is specified in a data description entry included
in a record description entry containing the EXTERNAL clause,
data-name-1, if specified, must reference a data item possessing the
external attribute which is described in the same Data Division.
If the OCCURS clause is specified in a data description entry
subordinate to one containing the GLOBAL clause, data-name-1, if
specified, must be a global name and must reference a data item which
is described in the same Data Division.
At the time that the group item, or any data item that contains a
X subordinate OCCURS DEPENDING ON item or that follows but is not
X subordinate to the OCCURS DEPENDING ON item, is referenced, the value of
the object of the OCCURS DEPENDING ON clause must fall within the range
integer-1 through integer-2.
When a group item containing a subordinate OCCURS DEPENDING ON item is
referred to, the part of the table area used in the operation is
determined as follows:
- If the object is outside the group, only that part of the table area
that is specified by the object at the start of the operation will be
used.
- If the object is included in the same group and the group data item is
referenced as a sending item, only that part of the table area that is
specified by the value of the object at the start of the operation
will be used in the operation.
- If the object is included in the same group and the group data item is
referenced as a receiving item, the maximum length of the group item
will be used in the operation.
Following are the verbs that are affected by the maximum length rule:
- ACCEPT identifier (Format 1 and 2)
- CALL ... USING BY REFERENCE
- X INVOKE ... USING BY REFERENCE
- MOVE ... TO identifier
- READ ... INTO identifier
- RELEASE identifier FROM ...
- RETURN ... INTO identifier
- REWRITE identifier FROM ...
- STRING ... INTO identifier
- UNSTRING ... INTO identifier DELIMITER IN identifier
- WRITE identifier FROM ...
The maximum length of variable-length groups is always used when they
appear as the identifier on the CALL ... USING BY REFERENCE identifier
statement. Therefore, the object of the OCCURS DEPENDING ON clause does
not need to be set, unless the group is variably-located.
X If the group item is followed by a non-subordinate item, the actual
X length, rather than the maximum length, will be used. At the time the
X subject of entry is referenced, or any data item subordinate or
X superordinate to the subject of entry is referenced, the object of the
X OCCURS DEPENDING ON clause must fall within the range integer-1 through
X integer-2.
In one record description entry, any entry that contains an OCCURS
DEPENDING ON clause can be followed only by items subordinate to it.
The OCCURS DEPENDING ON clause cannot be specified as subordinate to
another OCCURS clause.
X The following constitute complex OCCURS DEPENDING ON:
- X Subordinate items can contain OCCURS DEPENDING ON clauses.
- X Entries containing an OCCURS DEPENDING ON clause can be followed by
X non-subordinate items. Non-subordinate items, however, cannot be the
X object of an OCCURS DEPENDING ON clause.
- X The location of any subordinate or non-subordinate item, following an
X item containing an OCCURS DEPENDING ON clause, is affected by the
X value of the OCCURS DEPENDING ON object.
- X Entries subordinate to the subject of an OCCURS DEPENDING ON clause
X can contain OCCURS DEPENDING ON clauses.
- X When implicit redefinition is used in a File Description (FD) entry,
X subordinate level items can contain OCCURS DEPENDING ON clauses.
- X The INDEXED BY phrase can be specified for a table that has a
X subordinate item that contains an OCCURS DEPENDING ON clause.
X For more information on complex OCCURS DEPENDING ON, see the IBM COBOL
X Programming Guide for your platform.
All data-names used in the OCCURS clause can be qualified; they can not be
subscripted or indexed.
The ASCENDING/DESCENDING KEY and INDEXED BY clauses are described under
"Fixed-Length Tables" in topic 5.3.10.1.
© Copyright IBM Corp. 1991, 1998
IBM Library Server Copyright 1989, 2005 IBM Corporation. All rights reserved.
Return to library:
z/OS |
z/OS.e |
TPF |
z/VSE |
z/VM |
IBM Hardware |
IBM System z Redbooks
Glossary:
IBM terminology
Publications:
How to order publications
Readers:
Download IBM Library Reader |
Download IBM Softcopy Reader |
Download Adobe® Acrobat® Reader®
Library management:
Download IBM Softcopy Librarian
Contacts:
Contact z/OS
Adobe, the Adobe logo, Acrobat, the Acrobat logo, and Acrobat Reader are registered trademarks
of Adobe Systems incorporated.