CLOSE Statement

Closes one or more OPENed files.

Syntax

CLOSE filevar{, filevar} ...

Syntax Elements

filevar is the name of a variable containing a file reference (assigned via an OPEN statement).

Operation

The CLOSE statement is used in conjunction with the OPEN statement. Use this statement when you no longer need to access an opened local or remote file.

If the file is not open, a run time error occurs. You can test whether the variable refers to an open file with the VARVALTYPE function.

Any item locks held on the file are released.

Example

OPEN 'QA4'TO F1 ELSE PRINT "NO FILE"; STOP
.
.
CLOSE F1
.
.

This program opens the file QA4 and saves a reference to the open file in variable F1. If QA4 does not exist, the message NO FILE is displayed and the program terminates. When access of QA4 is no longer necessary, it is closed.

Go to top button