ProvideX V8.20 > Language Reference > 2. Directives
269
READ Directive
          Read Data from File
Format
READ (chan[,fileopt])varlist
Where:
chan
Channel or logical file number of the file from which to read the data.
Supported file options (see also, File Options, p.808):
fileopt
BSY=stmtref Traps Error #0: Record/file busy
DIR=num Direction indicator (not supported with [WDX] tag).
DOM=stmtref Missing record transfer
END=stmtref END-OF-FILE transfer
ERR=stmtref Error transfer
IND=num Record index
KEY=string$ Record key. (See Automatic Padding with KEY=Option)
KNO=num | name$ File access key number (num) or name (name$)
REC=name$ Record prefix (REC=VIS(string$) can also be used)
RNO=num Record number
RTY=num Number of retries (one second intervals)
SIZ=num Number of characters to read
TBL=stmtref Data translation table
TIM=num Maximum time-out value in integer seconds.
Comma-separated list of variables, literals, and IOL= options.
varlist
stmtref
Program line number or label to transfer control to.
Description
Use the READ directive to read data from the file you identify by channel.
When it's read, the data will be split into one or more fields, either separated by the
currently defined separator character or defined by embedded formats, with the
contents of the first field placed in variable 1, the second field in variable 2, etc.
ProvideX will convert numeric data automatically on a READ statement when
moving it to numeric variables. Numeric data converted during a READ directive
does not use the 'DP' Decimal Point Symbol or 'TH' Thousands Separator system
parameters for European decimal settings.
If you want to skip a field in the record, use an asterisk '*' as a place holder instead of
a variable name. You can refer to an IOList instead of using a list of variables in
varlist. To do this, use IOL=iolref. The iolref can be a line number or label for the line
containing an IOList, or it can be a string containing a compiled IOList.
If you do not include variables in the READ directive, ProvideX will use the IOL=
option (if you included one) in the OPEN statement for the given file. If varlist
contains more variables than there are current fields in the record, then ProvideX
initializes the additional variables to either zero (for numeric variables) or a null
string (for string variables).