Intel® Fortran Compiler 17.0 Developer Guide and Reference
When you open a disk file, you can use the OPEN statement POSITION specifier to request one of the following initial record positions within the file:
The initial position before the first record (POSITION='REWIND')
A sequential access READ or WRITE statement will read or write the first record in the file.
A point beyond the last record in the file (POSITION='APPEND'), just before the end-of-file record, if one exists
For a new file, this is the initial position before the first record (same as 'REWIND'). You might specify 'APPEND' before you write records to an existing sequential file using sequential access.
The current position (POSITION='ASIS')
This is usually used only to maintain the current record position when reconnecting a file. The second OPEN specifies the same unit number and specifies the same file name (or omits it), which leaves the file open, retaining the current record position. However, if the second OPEN specifies a different file name for the same unit number, the current file will be closed and the different file will be opened.
The following I/O statements allow you to change the current record position:
REWIND sets the record position to the initial position before the first record. A sequential access READ or WRITE statement would read or write the first record in the file.
BACKSPACE sets the record position to the previous record in a file. Using sequential access, if you wrote record 5, issued a BACKSPACE to that unit, and then read from that unit, you would read record 5.
ENDFILE writes an end-of-file marker. This is typically done after writing records using sequential access just before you close the file.
Unless you use nonadvancing I/O, reading and writing records usually advances the current record position by one record. More than one record might be transferred using a single record I/O statement.