The BACKSPACE statement moves the position of a file opened for sequential access to the beginning of the current record. If there is no current record, the file position is moved to the beginning of the preceding record. If there is no preceding record, the file position is unchanged.
SyntaxBACKSPACE unit-numberBACKSPACE (position-spec-list)
Where:unit-number is a scalar INTEGER expression corresponding to the input/output unit number of an external file.position-spec-list is [[UNIT =] unit-number][, ERR=label][, IOSTAT=stat] where UNIT=, ERR=, and IOSTAT= can be in any order but if UNIT= is omitted, then unit-number must be first.label is a statement label that is branched to if an error condition occurs during execution of the statement.stat is a variable of type INTEGER that is assigned a positive value if an error condition occurs, a negative value if an end-of-file or end-of-record condition occurs, and zero otherwise.
If there is no current record and no preceding record, the file position is left unchanged.
If the preceding record is an endfile record, the file is positioned before the endfile record.
If the BACKSPACE statement causes the implicit writing of an endfile record, the file is positioned before the record that precedes the endfile record.
Backspacing a file that is connected but does not exist is prohibited.
Backspacing over records using list-directed or namelist formatting is prohibited.
Note that BACKSPACE may only be used on sequential access files.
Exampleinteger :: ios backspace 10 ! backspace file on unit 10 backspace(10,iostat=ios) ! backspace with status return