Backspace

Statement Purpose

The backspace statement will position an external file before the preceding record in that file. However, this statement will only work on files that have been connected for sequential access only.

Valid Specifiers

The backspace statement will support only three specifiers. They are as follows:

unit=

This specifier identifies the file that the programmer wishes to have the backspace operation preformed on. This, with the unit number of the file, or just the unit number by itself must always appear in the backspace statement.

iostat=

This specifier is not mandatory in the backspace statement. However, when used, it will store an integer value in a variable that is placed after the equal sign. The integer value that gets stored provides information on the status of the backspace operation. If there where no problems with the backspace operation, then a value of zero is stored in the variable. If an error occurred while attempting to preform the operation, then a positive integer value will get stored inside the variable.

err=

This is another optional specifier with the backspace argument. A statement label is referenced after the equals sign of the specifier. The program will branch to that statement if an error occurs while attempting the backspace operation.

Usage

The backspace statement is normally used with only a unit specifier as in the following, which moves the position pointer back one record in the file attached to unit 12.
		backspace (12)
If it might be necessary to include the iostat and err arguments, the backspace statement would appear like this.
		backspace (12,err=100,iostat=ierr)
Of course, a statement 100 would have to appear in the program later on and it would also be wise to include a print or write statement to display the error condition if it occurs.

For more information and examples see

lecture twenty two

example: backspace.f , noadv.f.

Up one level / Home


Written by Jason Wehr : jcw142@psu.edu and Maintained by John Mahaffy : jhm@cac.psu.edu