CLOSE directive

Closes files.


No options


Parameters

CHANNEL = scalars or texts
Numbers of the channels to which the files are attached, or identifiers of texts used for input (which, after "closing", can then be re-read)

FILETYPE = strings
Type of each file (input, output, unformatted, backingstore, procedurelibrary, graphics); default inpu

DELETE = strings
Whether to delete the file on closure (yes, no); default no


Description

Once you have finished using a file, CLOSE can be used to release the channel to which it is attached, so that the channel is available for use with some other file. Parameters CHANNEL and FILETYPE indicate the channel number and the type of file, as in the OPEN directive. The DELETE parameter is useful if you are using files to store data temporarily, perhaps to release workspace within GenStat. When you have finished with the file you can set DELETE=yes to request that it be deleted on closure so that disk space is not wasted. For example,

OPEN 'temp.bin'; CHANNEL=3; FILETYPE=unformatted

PRINT [CHANNEL=3;UNFORMATTED=yes] \

       Surveys[1900,1910...1990]

DELETE Surveys[1900,1910...1990]

 

"... and later on when you wish to retrieve the data ..."

READ [CHANNEL=3;UNFORMATTED=yes] \

       Surveys[1900,1910...1990]

CLOSE 3; FILETYPE=unformatted; DELETE=yes

You cannot close a channel to which the keyboard or screen are attached, nor the current input or output channels. Also you cannot use CLOSE to delete files that have been opened with ACCESS=readonly or that are protected by the computer's file system. However, you do not need to close every file before you stop running GenStat; files are automatically closed at the end of every GenStat program.


Options: none.

Parameters: CHANNEL, FILETYPE, DELETE.


See also

Directives: OPEN, ENQUIRE.