Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - abof() determine if database is at beginning of file http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 abof()              Determine if database is at beginning of file
------------------------------------------------------------------------------
 Declaration
   database.hdr

 Syntax
   func logical abof extern
   param alias sDatabase

 Arguments
   sDatabase is the alias to retrieve information about.

 Return
   A logical indicating if the record pointer is at the beginning of file.

 Description
   The abof() function verifies whether the last skip operation for the
   specified alias sDatabase tried to move the record pointer beyond the first
   record, i. e. beyond the beginning of the file (BOF). The BOF flag is cleared
   on the next skip operation, unless this also encounters BOF.

   The BOF flag is also cleared when the record pointer is adjusted by any
   database command, e. g. goto, seek, etc.

   The abof() function performs identically to the bof() function. abof()
   differs syntactically in that it accepts an alias as a parameter.

   Use abof() when your application has more than one database open at one
   time. The abof() function eliminates the need to manage the current
   workarea.

 Example
   #define EXAMPLE_DATABASE
   #include example.hdr

   proc Test_abof
   
   set alias sTest  to "stest.dbf"
   set alias sIdxLN to "stestln.fdx"
   
   open sTest
   !sTest set index to sIdxLN
   
   // Display all records in sTest in reverse order by last name.
   !sTest go bottom
   
   // We use abof() to test if the most recent skip command tried to skip
   // beyond the first record.
   do while .not. abof( sTest )
      ? sTest->lastname, sTest->firstname
      !sTest skip - 1
   enddo
   
   ?
   
   // This will display .F. because we are positioned on the first
   // record.
   !sTest go top
   ? abof( sTest )
   
   // This will output the contents of the lastname field in the
   // first record.
   ? sTest->lastname
   
   // This will display .T. because we tried to position beyond the first
   // record, i.e. we did hit the begin of file.
   !sTest skip -1
   ? abof( sTest )
   
   // This will again output the contents of the lastname field in the
   // first record because skip -1 does not position the record pointer
   // beyond the first record.
   ? sTest->lastname
   
   endproc

   proc main
   Test_abof()
   endproc

See Also: aeof() bof() eof() skip

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson