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



Matt,

I've got a page at a time...took me a while also.  I'm still not sure the
way I'm doing it the best, but it does seem to work.

Basically, I ended up keeping track of how many records had been displayed.

  select;                                                       
    when pDirectionToRead = READ_START;                         
      //First screen                                            
      wRelativePos = 1;                                         
      wCurRecNbr = 0;                                           
    when pDirectionToRead = READ_BACKWARD                       
       and wCurRecNbr <= MAX_RECORDS_FETCHED;                   
      // Start over at begining                                 
      wRelativePos = 1 - wNbrRecsRead;                          
      wCurRecNbr = 0;                                           
    when pDirectionToRead = READ_BACKWARD;                      
      // back to top of prior screen                            
      wRelativePos = 1 - MAX_SUBFILE_RECORDS - wNbrRecsRead;    
      wCurRecNbr += wRelativePos - 1;                           
    // must be READ_FORWARD                                     
    when wEOF;                                                  
      // top of current screen (redisplay)                      
      wRelativePos = 1 - wNbrRecsRead;                          
      wCurRecNbr += wRelativePos - 1;                           
    other;                                                      
      //last record fetched was never displayed  
      wRelativePos = 0;                          
      wCurRecNbr -= 1;                           
  endsl;                                         

Note that I fetch 11 records but display 10 so that I know if I'm at EOF.  I
wonder what effect adding/deleting a record in the file I'm accessing would
have.  Luckily, that's not an issue with this particular file and in any
case this is a simple inquiry program.




Charles


> -----Original Message-----
> From: Tyler, Matt [mailto:mattt@xxxxxxxxxxxxxx]
> Sent: Wednesday, September 15, 2004 2:45 PM
> To: 'RPG programming on the AS400 / iSeries'
> Subject: RE: different iterations of SQL run statements in 
> same program
> 
> 
> Dan,
>       Curious, how are you presenting the data set to the user(s),
> Page-at-a-time, full-load, other?  I have a couple of 
> page-at-a-time SQL
> programs that took me a while to figure out the relative 
> cursor positioning
> for paging.   
> 
> Thank you,
> Matt Tyler
> WinCo Foods, Inc
> mattt@xxxxxxxxxxxxxx
> 
> --
> This is the RPG programming on the AS400 / iSeries (RPG400-L) 
> mailing list
> To post a message email: RPG400-L@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
> or email: RPG400-L-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/rpg400-l.
> 

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.