Function Eof() Foundation
Determines whether the end of file was reached.
Eof() --> lEOF
The return value of Eof() is .T. (true) when an attempt has been made to move the record pointer in a work area beyond the last logical data record. Otherwise .F. (false) is returned. When no file is open in the work area, the function returns .F. (false). When no records are available, Eof() returns the value .T. (true).
The database function Eof() indicates whether the end of file in a work area has been reached. Each work area has its own End-Of-File (EOF) status which is set to the value .T. (true) when an attempt is made to move the record pointer beyond the last logical record. Eof() returns the value .T. until the record pointer is again moved. The EOF status is set to .T. after a failed search operation is performed (for example, with DbSeek() or LOCATE). An attempt to move beyond the logical end of file can also occur using the command SKIP or the function DbSkip(). When the function Eof() is used without the alias operator, it returns the EOF status for the current work area.
// The example shows the use of Eof() in the current and
// in another work area.
PROCEDURE Main
USE Customer ALIAS Cust NEW EXCLUSIVE
INDEX ON Upper(LastName+FirstName) TO CustA
USE Invoice ALIAS Inv NEW
GO BOTTOM
? Alias() // result: INV
? Eof() // result: .F.
DbSkip()
? Eof() // result: .T.
? Cust-> ( Eof() ) // result: .F.
? Cust-> ( DbSeek("XYZ") ) // result: .F.
? Cust-> ( Eof() ) // result: .T.
? Cust-> ( Found() ) // result: .F.
RETURN
// This example shows a common use of Eof(): checking for
// the end of the file in a DO WHILE loop. The example
// lists all addresses of customers with the name "Bell".
PROCEDURE Main
LOCAL cLastName := "BELL"
USE Customer NEW EXCLUSIVE
INDEX ON Upper(LastName+FirstName) TO CustA
DbSeek( cLastName )
DO WHILE cLastName == Trim(Upper(LastName)) .AND. ! Eof()
? LastName, FirstName
? Street
? City + ",", State, Zip,
?
DbSkip()
ENDDO
CLOSE Customer
RETURN
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.