IB Statements/last

From CometWiki

Jump to: navigation, search

LAST function

Syntax: LAST(lun [,EXCP=statement-label])

Discussion: The LAST function returns the value of the last key in the file that is open on the specified logical unit number. The last key is the highest ASCII valued key contained in the file.

Notes:

The LAST function is valid only for keyed files.

If the LAST function is attempted on an empty keyed file, an exception 2 (END OF FILE) will be reported.

The LAST function does not move the record pointer.

Other file-related functions: FIRST, KEY, PREV.

Example:

 OPEN (1) "SALES"
 LASTKEY$ = LAST(1,EXCP=9999)

In the above example, the LAST function is used to determine the value of the last key in the SALES file. If an exception occurs when this statement is executed, program control will transfer to exception-statement-label 9999.

Personal tools