10.1 BACKSPACE Statement

The BACKSPACE statement repositions a sequential file currently open for sequential access to the beginning of the preceding record. When the next I/O statement for the unit is executed, the preceding record is available for processing. The BACKSPACE statement takes one of the following forms:

BACKSPACE ([UNIT=]u [,ERR=s] [,IOSTAT=ios])
BACKSPACE u
u
Is a logical unit number.
s
Is the label of the executable statement that receives control if an error occurs.
ios
Is an integer scalar memory reference that is defined as a positive integer if an error occurs and zero if no error occurs.

Rules and Behavior

The unit number must refer to an open file on disk or magnetic tape. For example, the following statement repositions the open file on logical unit 4 to the beginning of the preceding record:

BACKSPACE 4

A BACKSPACE statement should not be specified for a file that is open for direct or append access. Backspacing from record n can only be done by rewinding to the start of the file and then performing n-1 successive READs to reach the previous record. For direct and append access, the current record count (n) is not available to the Fortran I/O system.


Previous Page Next Page Table of Contents