× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I was playing with using SQL in a green screen instead of using file I/O
but stumped with this problem. I looked in the archives but don't find
anything to for this problem exactly.



Normally you have a set of function.



PositionInputFile()

LoadOnePage()

LoadPreviousPage()



Etc that handle the loading of a subfile.



Position input file issues a SETLL and positions the input file based on
a input value.



LoadOnePage does a READ or READE and reads forward for the number of
records on a page and writes records to the subfile.



If Roll back key is pressed, the code issues a LoadPreviousPage which
loops backwards through the file using READP to position the file and
then issues a LoadOnePage to load a page.



LoadPreviousPage() is going to have to deal with things like 10 records
per page and only 5 records in the file, etc.



The problem doing something like this in SQL.



I can issues a:



Select Field1, Field2 From File1 Where PositionField >= aValue



This works fine for reading forward but what happens when you rollback.
SQL only sees the records that are greater than or equal to the position
to value. If I try to roll back before the value I am going to get a
record not found because as far as SQL is concerned the only records in
the file are those equal to or greater than the value.



How does one do the equivalent of the SETLL, READP, etc?



I could open the cursor over the whole file but then I would have to
read forward until I found the key I was trying to position and that
could be 1 to millions of records.



The one solution that I can come up with is closing the cursor and
opening another less then the position to value.



Any better solutions? Drop the capability of scrolling back from the
previous position?



Anyway, thanks.


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.