System Functions

KEP( )

Return Prior Record's Key

Format

KEP(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 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:

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

The system also supports the KEP( ) function for ODBC and many other database file types.

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

See Also

File Handling

Example

0010 open (13)"CUSTNO"
0020 read (13,key="zzz",dom=0030) ! 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