× 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.





Everything I've seen is some variation of read one extra record.

Realistically, that's the only way of finding the EOF when you don't know
how many records are there. In other words, you could get the record count
of the file and keep track of how many you've displayed.

True if you're not doing a READE or any kind of filtering in the program itself. For instance if you had a Subfile of Order Items and were doing a Read by Order Number, knowing the number of records in the file is useless. Maybe a quick SQL, like:


    Select Count(*) as LineCount from Orders Where Ordno = 100

and then when the number of Records you've added to the SFL equals LineCount, turn on SFLEND.

But most apps don't go through that much trouble.

This code will work as well and it's not necessary to do any extra reads:

C S0MoreData Begsr
c*
c Eval D2Rno = v2LastRno
c If D2Rno = 0 If it's first SFL Record
c FFKy01 ReadE AurfAU01L
c Endif
c Eval V1PageCt = 0
c*
c Dow V1pageCt < V1PageSize
c And Not %EOF(AuLfAU01)
c If Not %EOF(AuLfAU01)
c Eval V1pageCt = V1PageCt + 1 Increment Page Ct
c Eval D2Rno = D2Rno + 1 Increment SLF rrn
c Eval *IN37 = *On SFL Display
c Exsr S0MovFlds Move File Flds to SFL Fields
c Write FSfl
c Endif
c FFKy01 ReadE AurfAU01L
c Enddo
c*
c If %EOF(AuLfAU01)
c Eval *In38 = *On Turn on SFLEND
c Endif
c*
c*
c X0MoreData Tag
c Eval v2LastRno = D2Rno
c*
c Endsr



The above code ain't guarnteed but it is from a working program and I tested the situation where total records read = SFLPAGE. There is a SETLL that's not shown in another Subroutine that's called when the Selection Criteria changes.


HTH

Mike

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/



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.