Previous Topic Next topic Print topic


CLOSE

Purpose

Disassociates a file value from the physical file with which it was associated when it was opened.

Syntax

CLOSE FILE(reference)[ENVIRONMENT(LEAVE|REREAD)]
[,FILE(reference)[ENVIRONMENT(LEAVE|REREAD)]]…;

Abbreviation(s): ENV for ENVIRONMENT.

FILE specifies the file that is dissociated from the data set. CLOSE FILE(*) closes all open files.

Parameters

reference
Identifies one or more file constants, file variables, or file-valued functions.
ENVIRONMENT    
An option used by IBM PL/I programs to control disposition of magnetic tapes after the file is closed. Open PL/I simply parses and otherwise ignores this option.

Description

The CLOSE statement disassociates an Open PL/I file value from the physical file with which it was associated when it was opened.

Execution of a CLOSE statement closes the files identified by the references. Once closed, the files can be reopened and given different file attributes. It can also be used to designate a different operating system file or device.

Closing a closed file has no effect and is not an error.

Upon program termination (including abnormal termination), files not closed will be implicitly closed.

Example

CLOSE FILE(F);
CLOSE FILE(G(K));
CLOSE FILE (L), FILE (M);

Restrictions

None.

Previous Topic Next topic Print topic