# System Functions

KEC( ) | Return Key of Current Record

## Format

KEC(chan[,fileopt])
Where:

chan | Channel or logical file number of your given file.
fileopt | Supported file options (see File Options):
ERR=stmtref | Error transfer
KNO=num | string$ | File access key number (num) or name (string$)
stmtref | Program line number or statement label to which to transfer control.

## 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
- Access key specified using the KNO= option

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).

## See Also

File Handling

## 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