ILE COBOL Language Reference

INDEXED BY Phrase

The INDEXED BY phrase specifies the indexes that can be used with this table. The INDEXED BY phrase is required if indexing is used to refer to this table element. See Subscripting Using Index-Names (Indexing).

The value of an index is made accessible to a program by storing the value in an index data-item. Index data-items are described in the program by a data description entry containing the USAGE IS INDEX clause. The index value is moved to the index data-item through the SET statement.

Indexes normally are allocated in static memory associated with the program containing the table. Consequently, indexes are in the last-used state when a program is re-entered. However, in the following cases, indexes are allocated on a per-invocation basis. Thus, you must SET the value of the index on every entry for indexes on tables in the following sections:

INDEXED BY Phrase - Format
 
                    .--------------.
                    V              |
>>-INDEXED--+----+----index-name-1-+---------------------------><
            '-BY-'
 
 
index-name-1
Must follow the rules for formation of user-defined words. At least one character must be alphabetic.

Each index-name specifies an index to be created by the compiler for use by the program. These index-names are not data-names, and are not identified elsewhere in the COBOL program; instead, they can be regarded as private special registers for the use of this object program only. As such, they are not data, or part of any data hierarchy; as such, each must be unique.

If a data item possessing the GLOBAL attribute includes a table accessed with an index, the index defined for the table also possess the GLOBAL attribute.


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