Positions file at preceding record.
Syntax
The syntax of the BACKSPACE statement can take one of two forms:
Short form:
BACKSPACE integer-expression |
Long form:
BACKSPACE ( io-specifier-list ) |
- integer-expression
is the number of the unit connected to a sequential
file.
- io-specifier-list
is a list of the following comma-separated I/O specifiers:
- [UNIT=] unit
specifies the unit connected to an external file
opened for sequential access. unit must be an integer expression that evaluates to a
number greater than 0. If the optional keyword UNIT= is omitted, unit must be the first item in io-specifier-list.
- ERR=stmt-label
specifies the label of an executable statement to
which control passes if an error occurs during statement execution.
- IOSTAT=integer-variable
returns the I/O status after the statement executes.
If the statement executes successfully, integer-variable is set to zero. If an error occurs, it is set to
a positive integer that indicates which error occurred.
Description
The BACKSPACE statement causes the external file connected to unit to be positioned just before the preceding record
of the file. The file must be connected for sequential access.
Examples
The following statement causes the file connected to unit
10 to be positioned just before the preceding record:
The following statement causes the file connected to unit
17 to be positioned just before the preceding record. If an error
occurs during the execution of the statement, control passes to the
statement at label 99, and the error code is returned in ios:
BACKSPACE (17, ERR=99, IOSTAT=ios) |
Related statements
ENDFILE, OPEN, and REWIND
Related concepts
For information about I/O concepts, see Chapter 8 “I/O
and file handling”, which lists example programs that use
I/O. For information about I/O formatting, see Chapter 11 “Intrinsic
procedures”.