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 }
You can only use 'PRINT' and 'PRINT/DELETE' on sequential files.
The default is 'DELETE' for scratch files. For all other files, the default is 'KEEP'.
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 STATUS parameter has the same values as those listed for the DISPOSE keyword (see Section 9.6.9).
The disposition specified in a CLOSE statement supersedes the disposition specified in the OPEN statement, except that a file opened as a scratch file cannot be saved, printed, or submitted, and a file opened for read-only access cannot be deleted. For example, the following statement closes the file on unit 1 and submits it for printing:
CLOSE (UNIT=1, STATUS='PRINT')
The next statement closes the file on unit J and deletes it:
CLOSE (UNIT=J, STATUS='DELETE', ERR=99)