You can use both the primary and alternate keys to read records from an indexed file, either directly (random access) or in key sequence (sequential access). The access mode can be:
Access records in order of ascending or descending record key value (default)
Access records according to the value of the record key
Use the appropriate forms of I/O statement to switch between sequential and random access
The method of accessing an indexed file is defined using the ACCESS MODE IS clause in the SELECT clause, for example:
file-control. select idxfile assign to "idx.dat" organization is indexed access mode is dynamic record key is idxfile-record-key alternate record key is idxfile-alt-key.