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):
| ||||||||
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:
Current file access key or
Access key specified using the KNO= option
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:
KEN (nn) Returns last generated SQL statement passed to the PxPlus SQL ODBC Driver.
KEN (nn, IND=1) Returns cursor name for database.
KEN (nn, IND=2) Returns ODBC handles.
See Also
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 endTo 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"