Relative Files
Relative files can be read from the following device types:
- DISK
- DATABASE
Relative files can be read in sequential, random, or dynamic access modes.
When a relative file is read in sequential access mode, the record that is made available by the
READ statement is determined as follows:
- If the file position indicator was set by the processing of a START or OPEN statement, the record pointed to is made available if it is still accessible through the path indicated by the file position indicator. If the record is no longer accessible (due, for example, to deletion of the record), the current record pointer is updated to indicate the next existing record in the file. That record is then made available.
- If the file position indicator was set by the processing of a previous READ statement, the file position indicator is updated to point to the next existing record in the file. That record is then made available.
If the RELATIVE KEY phrase is specified for this file, READ statement processing updates the RELATIVE KEY data item to indicate the relative record number of the record being made available.
When a relative file is read in random access mode, the record with the relative record number contained in the RELATIVE KEY data item is made available. If the file does not contain such a record, the INVALID KEY condition exists, and READ statement processing is unsuccessful.