PREAD
Previous READ
This directive is used to READ data from a file normally in reverse order.
Syntax
Section titled “Syntax”[P]READ (channel [, I/O-opts]) [variable-list][, IOL=line-ref]
[P]READ RECORD (channel [, I/O-opts]) string-variablechannel- is an integer in the range of 0 to 32764 indicating the channel of an OPEN file. The default is 0.
I/O-opts- is one or more of the following specifiers:
Branching- ERR=line-ref DOM=line-ref END=line-ref
Record- IND=numeric-value KEY=string-value SRT=sort-name
Miscellaneous- TBL=line-ref ERC=error-code
variable-list- is a list of numeric and/or string variable names that receive values from the record.
line-ref- is the program line number or label containing an IOLIST directive that defines a variable list (the IOL= option may be used by itself or together with a variable list; the comma preceding IOL= is used only when a variable precedes IOL=), or the program line number or label to branch to if the specified error occurs.
string-variable- is the name of the string variable that receives the entire record as data.
Remarks
Section titled “Remarks”The PREAD directive is available starting with release level 8.0.
The only difference between PREAD and READ comes when the directive is executed on a DIRECT or SORT file without using the KEY= option. In this case, READ obtains the next record based on the next logical KEY value (the next highest collating sequence key) and PREAD obtains the next record based on the next logical PKY value (the next lowest collating sequence key, or previous key).
Please refer to the READ directive for further information.
Examples
Section titled “Examples”Please refer to the description of the READ directive for examples.
See also
Section titled “See also”EXTRACT, PEXTRACT, and READ directives
FKY, KEY, LKY, and PKY functions
From the Thoroughbred Basic Language Reference, Volume II: F–Q, version 8.9.1. Open this page in the PDF