IB Statements/last

From CometWiki

< IB Statements(Difference between revisions)
Jump to: navigation, search
Badge (Talk | contribs)
(New page: '''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 l...)

Latest revision as of 12:07, 22 May 2009

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