ILE COBOL Language Reference

Indexed Files

Indexed files can be read from the following device types:

Indexed files can be read in sequential, random, or dynamic access modes.

When an indexed file is read in sequential access mode, the record made available by the READ statement is determined as follows:

When an indexed file is read in random access mode, the record in the file with a key value equal to that of the current key of reference is then made available. If the file does not contain such a record, the INVALID KEY condition exists, and READ statement processing is unsuccessful. If the FORMAT phrase is not specified on the I-O statement when indexed files are read in random access mode, the first format defined in the file is used. Note that if externally described keys are being used and no format is specified, the first format included in the program is the one used to build the key. This format may not necessarily be the first format in the file.

If the KEY phrase is not specified, the prime RECORD KEY becomes the key of reference for this request. When dynamic access is specified, the prime RECORD KEY is also used as the key of reference for subsequent executions of sequential READ statements, until a different key of reference is established.

When the KEY phrase is specified, data-name-1 becomes the key of reference for this request. When dynamic access is specified, this key of reference is used for subsequent executions of sequential READ statements, until a different key of reference is established.

+-------------------------------IBM Extension--------------------------------+

For a file that allows duplicate keys (the DUPLICATES phrase is specified in the file-control entry), the first record with the specified key value is made available. The first record is determined by the order specified when the file was created. The system options are first-in first-out (FIFO), last-in first-out (LIFO), and no specific sequence (if neither LIFO not FIFO is specified).

To enable file status 02 for DUPLICATE KEY checking, you need:

+----------------------------End of IBM Extension----------------------------+


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