Perhaps, perhaps not. Could depend on the nature / structure of the File.
If the records are "Fixed Length", you can retrieve the last record by defining it as a random access file, simply retrieveing the record and examining the record number. To do this, review the GET function in help (or elsewhere). While not currently popular, this was (once upon a time, long ago and far away) one of the more common approaches to saving/restoring data in many basic programs.
But then again, if it is truly a fixed length file of "data" records a sophisticated program may have stored the records in some order besides "record number", in which instance, knowing the record number of the "last" record doesn't even approach the answer, so that could be much ado about nothing.
On the other hand, the program could be set up to never delete any records and always and only ever add records which are sequentially numbered starting from a specific integer (actually Long Ingeger) value, so just knowing the number of LINES in the data file gives a good approximation of the record number of the last record.
Finally, while it would 'read' all of the records, you could just open the file in word pad and look/search for the record number.
Personally, I would go ahead and generate the function to read the record into memory. If you are going to ever use this information, you will need to be able to do this. Then, I would read all of the records and place them in a data structure, and do a number of check/tests/validations/correction processes on the information to be sure that it was "as represented" to me. Then I would PROMPTLY save this in a more convenient manner (e.g. the closest relational database closet). Proceede directly to the next step of generating the program to deal with the relational database structure and 'loose' all memory of the arcane methodology used to interrogate the flat file thinnggyyyy.
MichaelRed
redmsp@erols.com
There is never time to do it right but there is always time to do it over
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.