ProvideX V8.20 > Language Reference > 3. System Functions
463
KEC( ) Function
              Return Key of Current Record
Format
KEC(chan[,fileopt])
Where:
chan
Channel or logical file number of your given file.
Supported file options (see also, File Options, p.808):
fileopt
ERR=stmtref Error transfer.
KNO=num | name$ File access key number (num) or name (name$).
stmtref
Program line number or label to transfer control to.
Returns
Current key or current logical position in file
Description
The KEC( ) function returns the current record's key. The result is based on:
· the current file access key or,
· the access key specified using the KNO= option.
The current logical position is the last key value specified on a READ or EXTRACT
regardless of whether a record was found.
Typically, the KEC( ) function is used after you read a record, to determine the key of
the record you just read (i.e., the key of the current record or current position in the
file). For more information, see File Handling in the ProvideX User's Guide.
Example
0010
OPEN (13) "CUSTNO"
0020
READ (13,KNO=0) R$
0030
LET K$=KEC(13), K1$=KEC(13,KNO=1)
0040
PRINT "Key: ",K$," Alt: ", K1$, " Data: ", R$
0050
GOTO 0020
1000
PRINT "End-of-file"
1010
END