System Functions
KEP( ) Return Prior Record's Ke y
   
Format KEP(chan[,fileopt])
 
Where:
 
  chan Channel or logical file number of your given file.
   
  fileopt Supported file options (see also, 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 prior record in file
   
Description The KEP( ) function returns the key of the record prior to the record in the file specified. The result is based on:
  • the current file access key or,
  • the access key specified using the KNO= option.

If the current record is at the start of the file, there is no prior record. ProvideX reports Error #2: END-OF-FILE on read or File full on write unless you include an ERR= or END= option.

ProvideX supports the KEP ( ) function for ODBC files. For more information, see File Handling in the ProvideX User's Guide.

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

See the '+K' System Parameter for more details. This functionality is a +PxPlus Exclusive

   
Example 0010 OPEN (13)"CUSTNO"
0020 READ (13,KEY="zzz",DOM=30) ! Go to End of file
0030 LET K$=KEP(13,END=1000)
0040 READ (13,KEY=K$)R$
0050 PRINT "Key: ",K$," Data: ",R$
0060 GOTO 0030
1000 PRINT "Back to the start"
1010 END