Skip to main content

CLOSE

Closes a MultiValue file.

Synopsis

CLOSE filevar [ON ERROR statements]

Arguments

filevar A file variable name used to refer to a MultiValue file. This filevar is supplied by the OPEN statement.

Description

The CLOSE statement is used to close a MultiValue file. It takes the file identifier filevar, defined by the OPEN statement.

If multiple OPEN statements have been issued for the same MultiValue file:

  • If the process has issued multiple OPEN statements specifying different filevar variables, you must issue a CLOSE for each filevar.

  • If the process has issued multiple OPEN statements specifying the same filevar, a single CLOSE for this filevar closes the MultiValue file.

  • If multiple processes have issued an OPEN statement for the same MultiValue file, you must issue a CLOSE for the filevar in each process, even if the processes specified the same filevar variable.

You can optionally specify an ON ERROR clause. If file close fails, the ON ERROR clause is executed. This may occur if filevar does not refer to an existing file, or if the filevar file has already been closed.

Alternatively, you can use the STATUS function to determine the status of the file close operation, as follows: 0=success; -1=file does not exist or has already been closed.

See Also

FeedbackOpens in a new tab