ProvideX V8.20 > Language Reference > 3. System Functions
468
KEY( ) Function
             Return Key of Next Record
Format
KEY(chan[,fileopt])
Where:
chan
Channel or logical file number of the file to reference.
Supported file options (see also, File Options, p.808):
fileopt
END=stmtref End-of-File transfer
ERR=stmtref Error transfer
KNO=num | name$ File access key number (num) or name (name$)
IND=num Record index
RNO=num Record number.
stmtref
Program line number or label to transfer control to.
Returns
Key of next record in file
Description
The KEY( ) function returns the key of either the next record in the file specified or,
via the IND= or RNO= options, the key of the record at the index/record number
specified. The result is based on:
· the current file access key or,
· the access key specified using the KNO= option.
For more information, see File Handling in the ProvideX User's Guide.
Example
0010
OPEN (13)"CUSTNO"
0020
LET K$=KEY(13,END=1000)
0030
READ (13,KEY=K$)R$
0040
PRINT "Key: ",K$," Data: ",R$
0050
GOTO 0020
1000
PRINT "End-of-file"
1010
END