FORTRAN Reference Manual

Statements
FORTRAN Reference Manual528615-001
7-11
BACKSPACE Statement
lbl
is the label of an executable statement in the current program unit to which
FORTRAN transfers control if an error occurs while executing the BACKSPACE
statement.
You can write the control specifiers in any order, except that if you omit the UNIT
keyword, you must write the unit specifier as the first item in the list.
Considerations
If the file is an unstructured disk file that does not exist, the BACKSPACE
statement creates it.
Backspacing over records that were written using list-directed formatting is likely to
cause an error because in general you do not know how many records are
processed by a given list-directed statement.
After a BACKSPACE statement on an EDIT format file, an INQUIRE statement’s
NEXTREC option returns the record number of the line preceding the new current
record (or -1 if there is none) as the latest record number.
You cannot backspace an EDIT format file if your program runs as a NonStop
process.
If you specify the ENV COMMON and NONSTOP directives, you cannot
backspace an EDIT format file, even if your program is not running as a NonStop
process.
If you backspace unit 5 or unit 6 and you have not already established a
connection for the unit, BACKSPACE implicitly opens the unit using default
parameters. If you specify ENV COMMON and you backspace unit 5 or unit 6, your
FORTRAN routines share access to standard input or standard output,
respectively, with routines written in other languages only if the access mode for
unit 5 is INPUT and for unit 6 is OUTPUT. However, the default access mode for
both units 5 and 6 is I-O. If you want to share access to the file connected to the
unit, you must set the unit’s access mode to INPUT (unit 5) or OUTPUT (unit 6)
before you execute the BACKSPACE statement. You can set the access mode:
°
In a FORTRAN OPEN statement, as in:
OPEN( 5, MODE = 'INPUT')
OPEN( 6, MODE = 'OUTPUT')
°
In a TACL ASSIGN command, as in:
ASSIGN FT005, , INPUT
ASSIGN FT006, , OUTPUT