HP Fortran Programmer's Reference (September 2007)

HP Fortran statements
CLOSE
Chapter 10 299
CLOSE
Terminates file connection.
Syntax
CLOSE (
io-specifier-list
)
io-specifier-list
is a list of the following comma-separated I/O specifiers:
[UNIT=]
unit
specifies the unit connected to an external file.
unit
must be a positive
integer-valued expression. If the optional keyword UNIT= is omitted,
unit
must be the first item in
io-specifier-list
.
ERR=
stmt-label
specifies the label of the executable statement to which control passes if an
error occurs during statement execution. If neither IOSTAT= or ERR= is
specified and an error occurs, the program aborts and a system error
message is issued.
stmt-label
must be in the same scoping unit as the
CLOSE statement with the ERR= specifier.
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. If neither
IOSTAT= or ERR= is specified and an error occurs, the program aborts and a
system error message is issued.
STATUS=
character-expression
specifies the state of the file after it is closed.
character-expression
can be
one of the following arguments:
'KEEP' Preserve the file after it is closed (default).
'DELETE' Do not preserve the file after it is closed.
The STATUS= specifier is ignored if the file was opened as a scratch file. See
“OPEN” on page 410 for a description of the OPEN statement.