next up previous contents index
Next: INQUIRE Statement Up: Input/Output Facilities Previous: OPEN Statement

CLOSE Statement

 

The CLOSE statement is used to close a file and break its connection to a unit. The unit and the file (if it still exists) are then free for re-use in any way. If the specified unit is not connected to a file the statement has no effect. The general form of the statement is:
CLOSE( control-list )
where the control-list may contain the following items:

UNIT=integer-expression specifies the unit number to close (the same as in the OPEN statement).
STATUS=character-expression specifies the status of the file after closure. The expression must have a value of either: 'KEEP' for the file to be preserved, or 'DELETE' for the file to be deleted after closure. The default is STATUS='KEEP' except for files opened with STATUS='SCRATCH': such files are always deleted after closure and STATUS='KEEP' is not permitted.
IOSTAT=integer-variable and ERR=label are both permitted, as in the OPEN statement (but not much can go wrong with a CLOSE statement).


Helen Rowlands
8/27/1998