BACKSPACE

Purpose

The BACKSPACE statement positions an external file connected for sequential access FORTRAN 2003 Begins or formatted stream access. FORTRAN 2003 Ends

Syntax



>>-BACKSPACE--+-u-------------------+--------------------------><
              '-(--position_list--)-'
 
 

u
is an external unit identifier. The value of u must not be an asterisk or a Hollerith constant.

position_list
is a list that must contain one unit specifier ([UNIT=]u) and can also contain one of each of the other valid specifiers:

[UNIT=] u
is a unit specifier in which u must be an external unit identifier whose value is not an asterisk. An external unit identifier refers to an external file that is represented by an integer expression, whose value is in the range 1 through 2147483647. If the optional characters UNIT= are omitted, u must be the first item in position_list.

ERR= stmt_label
is an error specifier that specifies the statement label of an executable statement in the same scoping unit to which control is to transfer in the case of an error. Coding the ERR= specifier suppresses error messages.

IOMSG= iomsg_variable
is an input/output status specifier that specifies the message returned by the input/output operation. iomsg_variable is a scalar default character variable. It must not be a use-associated nonpointer protected variable. When the input/output statement containing this specifier finishes execution, iomsg_variable is defined as follows:

IOSTAT= ios
is an input/output status specifier that specifies the status of the input/output operation. ios is an variable. When the BACKSPACE statement finishes executing, ios is defined with:

Rules

After the execution of a BACKSPACE statement, the file position is before the current record if a current record exists. If there is no current record, the file position is before the preceding record. If the file is at its initial point, file position remains unchanged.

You cannot backspace over records that were written using list-directed or namelist formatting.

For sequential access, if the preceding record is the endfile record, the file is positioned before the endfile record.

If the ERR= and IOSTAT= specifiers are set and an error is encountered, transfer is made to the statement specified by the ERR= specifier and a positive integer value is assigned to ios.

+-------------------------------IBM Extension--------------------------------+

If IOSTAT= and ERR= are not specified,

+----------------------------End of IBM Extension----------------------------+

Examples

   BACKSPACE 15
   BACKSPACE (UNIT=15,ERR=99)
      ...
99 PRINT *, "Unable to backspace file."
   END

Related Information

IBM Copyright 2003