File Position Indicator
The file position indicator is a conceptual entity used in this document to facilitate exact specification
of the next record to be accessed within a given file during certain sequences
of input-output operations. The concept of a file position indicator has no
meaning for a file opened in the output or extend mode. The setting of the
file position indicator is affected only by the OPEN, READ, RETURN, ROLLBACK
and START statements as follows:
- The OPEN statement positions the file position indicator to the first
record in the file.
IBM Extension
IBM Extension The file position indicator can be positioned to any record in the file by using the POSITION parameter of the Override with database file (OVRDBF) command. End of IBM Extension
End of IBM Extension - For a sequential access READ statement, or a dynamic access READ NEXT
statement, the following considerations apply:
- If an OPEN or START statement positioned the file position indicator, the record identified by the file position indicator is made available. If this record no longer exists, the next existing record is made available.
- If a previous READ statement positioned the file position indicator, the file position indicator is updated to point to the next existing record in the file; that record is then made available.
IBM Extension
IBM Extension
- For a dynamic access READ FIRST statement, the file position indicator is positioned to point to the first record in the file; that record is then made available.
- For a dynamic access READ LAST statement, the file position indicator is positioned to point to the last record in the file; that record is then made available.
- For a dynamic access READ PRIOR statement, the file position indicator is positioned to point to the previous existing record in the file; that record is then made available.
End of IBM Extension
- For the RETURN statement, the following considerations apply:
- The first RETURN statement positions the file position indicator to the first record in the file, and that record is then made available.
- If a previous RETURN statement positioned the file position indicator, the file position indicator is updated to point to the next existing record in the file, and the record is then made available.
- IBM ExtensionIBM Extension For the ROLLBACK statement, the following considerations apply to any file under commitment control:
- The ROLLBACK statement sets the file position indicator to the pointer’s position at the previous commitment boundary. This is important to remember if you are doing sequential processing.
- The file position indicator is set to the pointer’s position at the OPEN if no COMMIT statement has been issued since the file was opened.
- The file position indicator is undefined for any file under commitment control that is not open.
End of IBM Extension - The START statement positions the file position indicator to the first record in the file that satisfies the implicit or explicit comparison specified in the START statement.
The concept of the file position indicator has no meaning for files with an access mode of random or for TRANSACTION files.