Skip to content

PEXTRACT

Previous EXTRACT

This directive is used to READ data from a file and/or prevent anyone from WRITEing to that file (and associated key space) until another action is taken on the designated Input/Output channel.

[P]EXTRACT (channel [, I/O opts]) [variable-list] [,IOL=line-ref]
[P]EXTRACT RECORD (channel [, I/O-opts]) string-variable
channel
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:
Record
IND=numeric-value KEY=string-value SRT=sort-name
Branching
ERR=line-ref DOM=line-ref END=line-ref
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.

The PEXTRACT directive is available starting with release level 8.0.

The only difference between PEXTRACT and EXTRACT comes when the directive is executed without using the KEY= I/O option. In this case, EXTRACT obtains the next record based on the next logical KEY value (the next highest collating sequence key) and PEXTRACT obtain the next record based on the next logical PKY value (the next lowest collating sequence key, or previous key).

Please refer to the EXTRACT directive for further information.

Please refer to the description of the EXTRACT directive for examples.

EXTRACT, PREAD, 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