CLOSE concludes any pending operations with the stream number specified and releases the stream for reuse. If the stream number has not been opened, an error will occur.
CLOSE is necessary for all file output operations, since data is automatically buffered in memory and not sent to the disk drive until a large quantity is ready to go. If an output stream is not closed, you may lose data.
If CLOSE is used without any inputs, all open data streams are closed and I/O will reverts to the console and keyboard. Only the copy stream opened with the COPYON command remains open.
The following procedure creates a disk file and prints an address into it.
- MAKE "STANDARD.OUTPUT CREATE "ADDRESS
- PRINT [JOHN Q. PUBLIC]
- PRINT [ANYTOWN, U.S.A.]
- CLOSE :STANDARD.OUTPUT
- MAKE "STANDARD.OUTPUT 0
To view the file, enter the editor and load the file ADDRESS.