The CLOSE command breaks the connection between a process and a device.
The format of the CLOSE command is:
C[LOSE][:tvexpr] expr[:(keyword[=expr][:...])][,...]
The optional truth-valued expression immediately following the command is a command postconditional that controls whether or not GT.M executes the command.
The required expression specifies the device to CLOSE.
The optional keywords specify deviceparameters that control device behavior; some deviceparameters take arguments delimited by an equal sign (=); if there is only one keyword, the surrounding parentheses are optional.
An indirection operator and an expression atom evaluating to a list of one or more CLOSE arguments form a legal argument for a CLOSE.
When a CLOSE is issued, GT.M flushes all pending output to the device, and processes any deviceparameters. CLOSEing a device not currently OPEN has no effect.
If the device is a temporary mailbox and the process is the only process accessing the mailbox, the device driver deletes the mailbox.
GT.M retains the characteristics of all device types, except a Files-11 RMS, for use in case of subsequent re-OPENs. If the device is a Files-11 RMS, characteristics controlled by deviceparameters are lost after the CLOSE.
CLOSE may send sequential files to the VMS queue manager for processing. The CLOSE command provides deviceparameters that SPOOL the file for printing on a printer or terminal, or SUBMIT the file to batch for execution. Many of the CLOSE deviceparameters for sequential files control queue behavior for either SPOOL or SUBMIT or both, and therefore must be used with SPOOL and/or SUBMIT to have any effect.
If the device being CLOSEd is $IO, GT.M implicitly USEs $PRINCIPAL. GT.M ignores CLOSE $PRINCIPAL.
Example:
CLOSE sd:(SPOOL:QUEUE=que:DELETE)
This CLOSEs the device, and if it is an RMS file on disk or tape, it spools the file for printing on the QUEUE specified by the variable que. The CLOSE also marks the file for deletion after printing.
Example:
CLOSE SD:RENAME=SD_".SAV"
This closes the device and, if it is a disk file, renames it to have the type .SAV.