Provides details about files opened by Genstat.
No options
Parameters
CHANNEL = scalars |
Channel numbers to enquire about; for FILETYPE=input or output , a scalar containing a missing value will be set to the number of the current channel of that type and a negative value can be used to check the existence of a file that is not yet connected to a channel |
---|---|
FILETYPE = string tokens |
Type of each file (input , output , unformatted , backingstore , procedurelibrary , graphics ); default inpu |
OPEN = scalars |
To indicate whether or not the corresponding channels are currently open (0=closed, 1=open) |
NAME = texts |
External name of the file, if channel is open |
EXIST = scalars |
To indicate whether files on corresponding channels currently exist (0=not yet created, 1=exist) |
WIDTH = scalars |
Maximum width of records in each file (only relevant for input and output files, set to * for other types) |
PAGE = scalars |
Number of lines per page (relevant only for output files) |
ACCESS = texts |
Allowed type of access: set to 'readonly' , 'writeonly' or 'both' |
LINE = scalars |
Number of the current line (input files only) |
STYLE = texts |
Underlying style of an output channel: set to 'plaintext' , 'html' , 'rtf' , or 'latex' (see OPEN ) |
OUTSTYLE = texts |
Current style of an output channel: set to 'plaintext' or 'formatted' (see OUTPUT ) |
SIZE = texts |
Size of the file, in bytes |
Description
ENQUIRE
allows you to ascertain whether a particular channel is already in use and, if so, what properties are defined for aspects like the width of each line or the number of lines per page (see the OPEN
and OUTPUT
directives). This is likely to be of most use within general programs and procedures.
You specify the channel using the parameters CHANNEL
and FILETYPE
; the other parameters allow you to save the required information in data structures of the appropriate type.
ENQUIRE
can also be used to discover whether a file exists. You simply set the CHANNEL
option to a negative number. The result of the enquiry is saved by the EXIST
parameter. So, for example
ENQUIRE CHANNEL=-1; NAME='lost.dat'; EXIST=Found
will set the scalar Found
to one if the file lost.dat
exists, or to zero otherwise. Similarly, the SIZE
parameter can provide the size of the file (in bytes): for example
ENQUIRE CHANNEL=-1; NAME='lost.dat'; SIZE=Nbytes
A missing value is returned if the file does not exist.
Options: none.
Parameters: CHANNEL
, FILETYPE
, OPEN
, NAME
, EXIST
, WIDTH
, PAGE
, ACCESS
, LINE
, STYLE
, OUTSTYLE
.
See also
Directives: OPEN
, CLOSE
, FCOPY
, FDELETE
, FRENAME
.
Commands for: Input and output.
Example
" Example 1:3.3.4 " OPEN '%GENDIR%/Examples/GuidePart1/Weather.dat',\ '%GENDIR%/Examples/GuidePart1/Summary.out';\ CHANNEL=2; FILETYPE=input,output ENQUIRE 2,2; FILETYPE=input,output;\ NAME=In2,Out2; WIDTH=InW2,OutW2; ACCESS=InAcc2,OutAcc2 PRINT In2,InW2,InAcc2; FIELDWIDTH=*,6,10; DECIMALS=0 & Out2,OutW2,OutAcc2; FIELDWIDTH=*,6,10; DECIMALS=0 CLOSE 2,2; FILETYPE=input,output