10.2 CLOSE Statement

The CLOSE statement disconnects a file from a unit. It takes the following form:

                  { STATUS  }
CLOSE ([UNIT=]u[, { DISPOSE } =p] [,ERR=s] [,IOSTAT=ios])
                  { DISP    }
u
Is a logical unit number.
p
Is a character expression that determines the disposition of the file. It can be any one of the following values:

The default is 'DELETE' for scratch files. For all other files, the default is 'KEEP'.

s
Is the label of an executable statement.
ios
Is an integer scalar memory reference.

Rules and Behavior

CLOSE statement parameters can occur in any order. The UNIT keyword is optional if the unit specifier is the first parameter in the list.

The disposition specified in the CLOSE statement supersedes the disposition specified in the OPEN statement, except that a file opened as a scratch file cannot be saved. For example, the following statement closes the file on unit J and deletes it:

CLOSE (UNIT=J, STATUS='DELETE', ERR=99)

A file opened as a scratch file cannot be saved, printed, or submitted, and a file opened for read-only access cannot be deleted.


Previous Page Next Page Table of Contents