The CLOSE statement disconnects a file from a unit. It takes the following form:
                          {STATUS  }
 CLOSE ([UNIT=]io-unit [, {DISPOSE } =p] [,ERR=label] [,IOSTAT=i-var])
                          {DISP    }
| 'KEEP' or 'SAVE' | Retains the file after the unit closes. | 
| 'DELETE' | Deletes the file after the unit closes.[1] | 
| 'PRINT' [2] | Submits the file to the line printer spooler, then retains it. | 
| 'PRINT/DELETE' [2] | Submits the file to the line printer spooler, then deletes it. | 
| 'SUBMIT' | Submits the file to the batch job queue, then retains it. | 
| 'SUBMIT/DELETE' | Submits the file to the batch job queue, then deletes it. | 
|  
 
[1] Unless OPEN(READONLY) is in
effect.
  | |
The default is 'DELETE' for scratch files. For all other files, the default is 'KEEP'.
The CLOSE statement specifiers can appear in any order. An I/O unit must be specified, but the UNIT specifier is optional if the unit specifier is the first item in the I/O control list.
The status specified in the CLOSE statement supersedes the status 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.
If a CLOSE statement is specified for a unit that is not open, it has no effect.
Consider the following statement:
CLOSE (UNIT=J, STATUS='DELETE', ERR=99)
This statement closes the file connected to unit J and deletes it. If an error occurs, control is transferred to the statement labeled 99.
Consider the following statement:
CLOSE (UNIT=1, STATUS='PRINT')
This statement closes the file on unit 1 and submits it for printing.