Library View Topics Framed Contents Revised Topics Previous Topic Next Topic Search Search ResultsPrevious Topic MatchNext Topic Match Notes List Notes Print Download No PDF Handheld DisconnectedHandheld ConnectedHelp

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:

Following are the verbs that are affected by the maximum length rule:

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 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.

Previous Topic Next Topic © 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.