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

1.5.1.8 Subscripting



Subscripting is a method of providing table references through the use of subscripts. A subscript is a positive integer whose value specifies the occurrence number of a table element.


    ___ Format _____________________________________________________________ 
   |                                                                        |
   |                           <_________________________                   |
   | >>__ _condition-name-1_ ____ _____________________ _|________________> |
   |     |_data-name-1______|    |_ _IN_ __data-name-2_|                    |
   |                               |_OF_|                                   |
   |                                                                        |
   | >__ _____________________ ___________________________________________> |
   |    |_ _IN_ __file-name-1_|                                             |
   |      |_OF_|                                                            |
   |                                                                        |
   |       <________________________________________                        |
   | >__(____ _integer-1__________________________ _|__)_________________>< |
   |         |_ALL________________________________|                         |
   |         |_data-name-3__ __________________ __|                         |
   |         |              |_ _+_ __integer-2_|  |                         |
   |         |                |_-_|               |                         |
   |         |_index-name-1__ __________________ _|                         |
   |                         |_ _+_ __integer-3_|                           |
   |                           |_-_|                                        |
   |                                                                        |
   |________________________________________________________________________|
condition-name-1
The conditional variable for condition-name-1 must contain an OCCURS clause or must be subordinate to a data description entry which contains an OCCURS clause.

data-name-1
Must contain an OCCURS clause or must be subordinate to a data description entry which contains an OCCURS clause.

data-name-2, file-name-1
Must name data items or records that contain data-name-1.

integer-1
Can be signed. If signed, it must be positive.

data-name-3
Must be a numeric elementary item representing an integer.


X Data-name-3 can be qualified. Data-name-3 cannot be a windowed date
X field.

index-name-1
Corresponds to a data description entry in the hierarchy of the table being referenced which contains an INDEXED BY phrase specifying that name.

integer-2, integer-3
Cannot be signed.

The subscripts, enclosed in parentheses, are written immediately following any qualification for the name of the table element. The number of subscripts in such a reference must equal the number of dimensions in the table whose element is being referenced. That is, there must be a subscript for each OCCURS clause in the hierarchy containing the data-name including the data-name itself.

When more than one subscript is required, they are written in the order of successively less inclusive dimensions of the data organization. If a multi-dimensional table is thought of as a series of nested tables and the most inclusive or outermost table in the nest is considered to be the major table with the innermost or least inclusive table being the minor table, the subscripts are written from left to right in the order major, intermediate, and minor.

For example, if TABLE-THREE is defined as:


     01  TABLE-THREE.
         05  ELEMENT-ONE OCCURS 3 TIMES.
             10  ELEMENT-TWO OCCURS 3 TIMES.
                 15  ELEMENT-THREE OCCURS 2 TIMES    PIC X(8).

a valid subscripted reference to TABLE-THREE is:


         ELEMENT-THREE (2 2 1)

Subscripted references may also be reference modified. See the third example in topic 1.5.1.9.2. A reference to an item must not be subscripted unless the item is a table element or an item or condition-name associated with a table element.

Each table element reference must be subscripted except when such reference appears:

The lowest permissible occurrence number represented by a subscript is 1. The highest permissible occurrence number in any particular case is the maximum number of occurrences of the item as specified in the OCCURS clause.

Subtopics:



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.