System Functions

KEN( )

Return Key After Next

Format

KEN(chan[,fileopt]) 

Where:

chan

Channel or logical file number of your given file.

fileopt

Supported file options (see File Options):

END=stmtref

End-of-File transfer

ERR=stmtref

Error transfer

KEY=string$

Record key

KNO=num | string$

File access key number (num) or name (string$)

stmtref

Program line number or statement label to which to transfer control.

Returns

Key of the record that follows the next record in the file.

Description

The KEN( ) function returns the key of the record which directly follows the next record in the file specified. The result is based on the:

If the '+K' system parameter is not enabled, the 'Record Key' specified must exist on the file.

For ODBC files, the KEN( ) function supports some debugging tools:

See Also

File Handling

Example

0010 open (13)"INVDET"
0020 K$=key(13,end=1000)
0030 rem Last record is total line - different format
0040 KN$=ken(13,end=0080); if KN$(1,6)<>K$(1,6) goto 0080
0050 read (13)iol=8010 ! Get record
0060 gosub 7000 ! Process invoice line
0070 goto 0020
0080 read (13)iol=8010 ! Get total line
0090 gosub 7500; goto 0020
1000 end

To return the current ODBC SQL statement being passed to the PxPlus SQL ODBC Driver:

open (1) "[odb]Database;customer;key=custid"
read (1,key="MIKE")
print ken(1)
select * from customer where custid$="MIKE"