A CLOSE statement may be executed only for a file in an open mode. After
successful execution of a CLOSE statement without the REEL or UNIT phrase:
- The record area associated with the file-name-1 is no longer available.
Unsuccessful execution of a CLOSE statement leaves availability of the record
data undefined.
- An OPEN statement for the file must be executed before any other input/output
statement.
The following considerations apply to the use of the CLOSE statement:
- If the file is in an open status and the execution of a CLOSE statement is unsuccessful, the EXCEPTION/ERROR
procedure (if specified) for this file is executed.
- If a CLOSE statement without a REEL or UNIT phrase has not been processed
before the end of the run unit is reached, or before the program is cancelled,
then the file is closed implicitly.
- If the SELECT OPTIONAL clause is specified in the file-control entry for
this file, and the file is not present at run time, standard end-of-file processing
is not performed.
- If the FILE STATUS clause is specified in the FILE-CONTROL entry, the
associated status key is updated when the CLOSE statement is executed. For
more information about the status key, see Common Processing Facilities.
- For Relative Files Only: To extend a relative file
boundary beyond the current number of records and within the file size, use
the INZPFM command to add deleted records before processing the file. You
will need to do this when more records need to be added to the file, and file
status 0Q has been received. Any attempt to extend a relative file beyond
its current size results in a boundary violation.