Skip to main content

This is documentation for Caché & Ensemble. See the InterSystems IRIS version of this content.

For information on migrating to InterSystems IRIS, see Why Migrate to InterSystems IRIS?


Closes a file opened for sequential access.


CLOSESEQ filevar [ON ERROR statements]


filevar A file variable name used to refer to the file in Caché MVBasic. This filevar is obtained from OPENSEQ.


The CLOSESEQ statement is used to close a file that has been opened for sequential access using OPENSEQ. A file opened for sequential access is exclusively held by the process that opened it. Issuing a CLOSESEQ allows that file to be accessed by other processes.

You can use the STATUS function to determine the status of the close operation, as follows: 0=close successful; -1=close failed either because file variable not defined or file has already been closed.

You can optionally specify an ON ERROR clause. If file close fails, the ON ERROR clause is executed. This may occur if the file is already closed. The statements argument can be the NULL placeholder keyword, a single statement, or a block of statements terminated by the END keyword. A block of statements has specific line break requirements: each statement must be on its own line; there must be a line break between the ON ERROR keyword and the first line.

See Also