Comet 32 Runtime
The CLOSE statement closes a specified
logical unit number,
one that was opened via a previous
Once a logical unit number (lun) is closed, it may be reassigned by another OPEN statement. A device that is closed by one task is available for use by other tasks. Note that data files are not treated as devices, therefore data files may be opened by more than one user at a time.
The CLOSE statement without a lun closes all logical unit numbers (including logical unit number 0).
The CLOSE statement is ignored if the logical unit number it refers to was not assigned by a previous OPEN statement.
OPEN (1) "LP1" . . . CLOSE (1)In this example, logical unit number 1 is opened and assigned to the printer device named LP1. Later in the program, logical unit number 1 is closed (and thus, LP1 is available for other applications).
CLOSE (6) & OPEN (6) "WORKFILE"In this example, logical unit number 6 is first closed, then opened and assigned to a data file named "WORKFILE." This technique guarantees that the logical unit number is available before the OPEN statement is executed.
CLOSE ! Close all logical unit numbers . . . OPEN (0) TERM$ ! Open TERM$ as logical unit number 0This example shows how the CLOSE statement without a lun closes all logical unit numbers. The OPEN statement is used to re-open the console device (TERM$) as lun 0.