ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Page at a time Subfile w/selection from multi sfl pages

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Page at a time Subfile w/selection from multi sfl pages

    I haven't done subfiles in a really long time and have forgotten most of what I learned and used (V4R?). We have just upgraded to V5R4. I have found enough documentation to get me up to this point but have been unable to find anything on handling scrolling while preserving user selections.

    I have finished creating/testing a page at a time subfile (SFLSIZ=SFLPAG) and I can select multiple rows on the same page. When I pageup or pagedown it clears the selections. I have a DS array to collect user selection in my rpg and currently it is only being populated when the user hits enter.

    I have included the primary code (not some of the maintenance routines).

    Code:
    d                 ds                                                
    d PgGCodDS                1    560                                  
    d  PgGCodSel                     7s 0 Overlay( PgGCodDS )  Dim( 80 )
    
    c                   DoW       ( KeyPressed <> F03 )  and  
    c                                 ( KeyPressed <> F12 )       
                                                              
    c                   ExSr      LoadSflPage                 
                                                              
    c                   DoW       ( KeyPressed <> F03 )  and  
    c                                 ( KeyPressed <> F12 )       
    c                   Eval      SflDspCtl   = True          
    c                   Eval      SflDsp      = True          
    c                   Eval      PgGNamPos   = *blanks       
    c                   Write     WindowRcd                   
    c                   Write     CmdKeyRcd                   
    c                   Write     MsgCtlRcd                   
    c                   ExFmt     SflCtlRcd                   
    c                   Write     RmvWindow     
    
    c                   If        NbrRcdsInPg = *zero        
    c                   Eval      RtnCde      = UserCancel   
    c                   Return                               
    c                   EndIf                                
                                                             
    c                   Eval      KeyPressed  = FDSKeyPressed
    c                   Eval      CursorPostn = FDSCsrPostn  
                                                             
    c                   If        NbrRcdsInPg <> *zero       
    c                   ExSr      ClrMsgSfl                  
    c                   EndIf                                
    c                   Eval      PostnCursor = False        
                                                             
    c                   Select                                             
    c                   When      ( KeyPressed >= F01 )  and
    c                             ( KeyPressed <= F24 )  or 
    c                               KeyPressed  = Help      
    c                   ExSr      PrcsCmdKey                
                                                            
    c                   If        ReBuildList               
    c                   Eval      ReBuildList = False       
    c                   Leave                               
    c                   EndIf                               
                                                            
    c                   When      ( KeyPressed = Enter ) and
    c                             ( PgGNamPos <> *blanks )  
    c                   ExSr      PositionList              
    c                   Leave                               
                                                            
    c                   When      KeyPressed  = PageUp      
    c                   If        TopOfList                 
    c                   Eval      MsgId       = 'DSP0132'   
    c                   ExSr      LoadMsgSfl
    c                   Else                
    c                   ExSr      PrcsPageUp
    c                   Leave               
    c                   EndIf
    
    c                   When      KeyPressed  = PageDown 
    c                   If        BtmOfList              
    c                   Eval      MsgId       = 'DSP0131'
    c                   ExSr      LoadMsgSfl             
    c                   Else                             
    c                   Eval      TopOfList   = False    
    c                   Leave                            
    c                   EndIf                            
    
    c                   Other                   
    c                   ExSr      PrcsSelection 
    c                   If        RcdWasSlctd   
    c                   Return                  
    c                   EndIf                   
    c                   EndSl                   
                                                
    c                   EndDo                   
    c                   EndDo                   
    
    c                   Return    
                
    c     LoadSflPage   BegSr                         
                                                      
    c                   ExSr      ClrSfl              
    c                   Eval      SflOpt      = *blank
    c                   Eval      SflEnd      = False 
    c                   Eval      BtmOfList   = False 
    c                   Eval      NbrRcdsInPg = *zero 
                                                      
    c                   DoW       NbrRcdsInPg < SflPag
    c                   Read      rSvfPGrp            
    c                   If        %eof ( SvfPGrp1 )   
    c                   Eval      BtmOfList   = True           
    c                   Eval      SflEnd      = True           
    c                   EndIf                                  
                                                               
    c                   If        BtmOfList                    
    c                   Leave                                  
    c                   EndIf                                  
                                                                                                                         
    c                   Eval      NbrRcdsInPg = NbrRcdsInPg + 1
    c                   Eval      CsrRRN      = CsrRRN + 1     
    c                   Write     SflRcd                       
                                                               
     *  Save the keys for the top of this page and the last pag
    c                   If        NbrRcdsInPg = 1              
    c                   Eval      LastPagKFld = *blanks        
    c                   If        KeyPressed  = PageDown       
    c                   Eval      LastPagKFld = TopOfPgKFld    
    c                   EndIf                                  
    c                   Eval      TopOfPgKFld = PgGNam         
    c                   EndIf                                  
    c                   EndDo                            
                                                         
    c                   If        not BtmOfList          
    c                   Read      rSvfPGrp               
    c                   If        %eof ( SvfPGrp1 )      
    c                   Eval      BtmOfList   = True     
    c                   Eval      SflEnd      = True     
    c                   Endif                            
    c                   If        not BtmOfList          
    c                   ReadP     rSvfPGrp               
    c                   EndIf                            
    c                   EndIf                            
                                                         
    c                   If        NbrRcdsInPg = *zero    
    c                   ExSr      AddBlkSflRcd           
    c                   Eval      SflEnd      = True     
    c                   Eval      MsgId       = 'DSP0311'
    c                   ExSr      SndNoRcdMsg            
    c                   EndIf
                             
    c                   EndSr
    
    c     PrcsSelection BegSr                                
                                                             
    c                   Eval      RcdWasSlctd = False        
    c                   Eval      PgGCodPrm   = *all'0'      
    c                   Clear                   PgGCodSel    
                                                             
    c                   ReadC     SflRcd                     
                                                             
    c                   Eval      Index       = 1            
                                                             
    c                   DoW       not %eof ( SvfPGrpSS )     
    c                   If        SflOpt     <> *blank       
    c                   Eval      RcdWasSlctd = True         
    c                   Eval      RtnCde      = GoodReturn   
    c                   Eval      PgGCodSel( Index ) = PgGCod
    c                   Eval      Index       = Index + 1    
    c                   EndIf                                
                                                             
    c                   ReadC     SflRcd                     
    c                   EndDo                                
    c                   If        not RcdWasSlctd        
    c                   Eval      MsgId       = 'DSP0281'
    c                   Eval      MsgDtaA     = 'a'      
    c                   Eval      MsgDtaB     = PrfGrpTxt
    c                   ExSr      LoadMsgSfl             
                                                         
    c                   Else                             
    c                   Eval      PgGCodPrm   = PgGCodDS 
    c                   EndIf                            
                                                         
    c                   EndSr
    What would be the 'best practice' way of handling the pageup and pagedown process to collect and correctly re-display what the user has selected as they scroll? Can I use the CSRRRN field defined in the DDS to index the DS array as I process scrolling? I also have a 'position to' function. I only want the user options cleared when they refresh or 'first pass'.

    Code:
    SFLCSRRRN( &CSRRRN )
    A            CSRRRN         5S 0H
    I have been using Kevin Vandever's book "Subfiles in RPG IV" to get this far. Is there a better resource?
    Last edited by ljpurvis; June 23, 2009, 09:43 AM. Reason: add main code

  • #2
    Re: Page at a time Subfile w/selection from multi sfl pages

    As I understand it the READC only comes into effect after the user presses enter, as this is when control passes back to the program. READC will then only process the record set currently on screen at the time that enter was klapped. All the other selections were removed with the page up/down subfile repaint, thus all those previous records are not flagged as changed.

    Maybe you need to experiment with making SFLSIZ > SFLPAG?

    Comment


    • #3
      Re: Page at a time Subfile w/selection from multi sfl pages

      Vernond,
      Thank you for your response.

      there are more than 9,999 records in the file which is why i am using the page at a time sfl

      Is there a way to scroll through a subfile with more than 9,999 records without using a page at a time?

      I am hoping that someone has some ideas for me, that I can tweak and make work...

      thnk u Vernond

      Comment


      • #4
        Re: Page at a time Subfile w/selection from multi sfl pages

        Wow guy! Can your users really page through 9999 records to select the ones they want?

        Wouldn't it be better if you had a screen or two prior to this one that would narrow the selection list down to something more manageable - say twenty or thirty records?

        There must be a neater way to get what you want.

        Comment


        • #5
          Re: Page at a time Subfile w/selection from multi sfl pages

          Yes, my users will scroll through the subfile to see what is in the master file and to see what they need to edit records and sometimes just to try and break it. I have a 'position to' that will get them to the records they need, but they could select up to 80 records (this may even grow larger in time) that are then passed to reporting parameters for selection/exclusion and sorting. This is a necessary evil due to the amount of data that they are processing.

          Right now I have modified the code to collect more than a page of selections by using an array index(counter) within the READC loop - haven't tested it yet

          Code:
          c                   DoW       PgGCodSel( Index ) <> *zero 
          c                   Eval      Index       = Index + 1     
          c                   EndDo                                 
          c                   Eval      PgGCodSel( Index ) = PgGCod 
          c                   Eval      Index       = Index + 1
          if it works, I will add this code to the main code in my original post and then start working on the pageup/pagedown requirement.

          Comment


          • #6
            Re: Page at a time Subfile w/selection from multi sfl pages

            We're a bit more conservative. If a user wants to edit a bunch of records then they do so one at a time: select, enter, edit, enter, page up/down and select next record, enter, edit.

            I don't see why they would need to be able select more than one at a time, but then I don't know your context. It does make me very nervous though!

            I don't know of any processing environment where it is a good idea to allow many users to simultaneously select a handful of records from the same source file for editing. Surely your data integrity becomes questionable in such an environment?

            For example, how long would it take person A to discover that person B has just over-written the changes that person A put in a minute ago?

            How are you going to add in code that will prevent person B from selecting a record (or two, or three) that person A currently has selected? How can you handle such "collisions"?

            Comment


            • #7
              Re: Page at a time Subfile w/selection from multi sfl pages

              Ooops, I didn't explain the purpose of the subfile to well.

              The only purpose of this subfile is to allow the user to select all appropriate records that will be used to run reports. While the users are perusing the lists they also look to see if any of the records contain invalid data. If invalid data exists, they will not run the report and will exit the process. They will then go into their data entry processes to edit the data (only one user/record at a time).

              So nothing funky going on here, I just have users that multi-multi task everything. Didn't mean to confuse you.

              Comment


              • #8
                Re: Page at a time Subfile w/selection from multi sfl pages

                That's okay. If you have a look at any of my other posts you will see that I confuse very quickly

                Oops, I'm confused again. See how quickly it happens?!

                Anyways, back to your prickly little problem: Have you tried going the (SFLSIZ > SFLPAG) route as yet? I've not come up with any other ideas yet.

                Comment


                • #9
                  Re: Page at a time Subfile w/selection from multi sfl pages

                  Working on the self extending option now, I don't like giving up (i have a bulldog mentality), but I am running out of time and patience.

                  I know I remember doing this in the past (many years ago).

                  How do you get help from the old timers on this forum? Do they ignore all the newbies? I would at least like to know if I am wasting my time on the page-at-a-time challenge.

                  Comment


                  • #10
                    Re: Page at a time Subfile w/selection from multi sfl pages

                    guess im old... if using a page at a time subfile the only way to track user entry
                    is to write it to a array by RRN and hope they dont have more than 9999 entries....

                    you need to capture the enter , page down and page up.

                    when user pages up you need to go back to the array (do lookup) by
                    rrn and put back the selection they entered prior to page down ..
                    cause maybe they changed their mind again ...


                    i use the hex for the function keys like this *NOTE : INDARA (important)

                    dds
                    PHP Code:
                    A                                      DSPSIZ(27 132 *DS4)
                    A                                      REF(*LIBL/LBAFREF
                    A                                      CHGINPDFT(UL)      
                    A                                      INDARA             
                    A                                      CF01               
                    A                                      CF02               
                    A                                      CF03               
                    A                                      CF04               
                    A                                      CF05               
                    A                                      CF06               
                    A                                      CF07               
                    A                                      CF08               
                    A                                      CF09               
                    A                                      CF10               
                    A                                      CF11               
                    A                                      CF12               
                    A                                      CF13               
                    A                                      CF14                    
                    A                                      CF15                    
                    A                                      CF16                    
                    A                                      CF17                    
                    A                                      CF18                    
                    A                                      CF19                    
                    A                                      CF20                    
                    A                                      CF21                    
                    A                                      CF22                    
                    A                                      CF23                    
                    A                                      CF24                    
                    A N41                                  PAGEDOWN                
                    A                                      PAGEUP                  
                    A                                      
                    PRINT 

                    rpg - look at field CHOICE You need to add hex definition for pageup/pagedown and do the magic array stuff there...
                    Code:
                    fARC19AD   cf   e             WORKSTN INFDS(INFDS)               
                    f                                     SFILE(SUB01:RRN1)          
                    f                                     SFILE(SUB02:RRN2)          
                    f                                     SFILE(SUB03:RRN3)          
                    f                                     SFILE(SUB04:RRN4)          
                    
                    d Infds           ds                                           
                    d Choice                369    369                             
                    d Currec                378    379I 0   
                    
                     // Command Keys                                                                          
                                                                                                              
                    d Cmd01           c                   const(x'31')                         Cmd-1          
                    d Cmd02           c                   const(x'32')                         Cmd-2          
                    d LeaveProgram    c                   const(x'33')                         Cmd-3          
                    d Prompt          c                   const(x'34')                         Cmd-4          
                    d Cmd05           c                   const(x'35')                         Cmd-5          
                    d AddNotes        c                   const(x'36')                         Cmd-6          
                    d PriorDay        c                   const(x'37')                         Cmd-7          
                    d Nextday         c                   const(x'38')                         Cmd-8          
                    d EmailNote       c                   const(x'39')                         Cmd-9          
                    d DeleteNote      c                   const(x'3A')                         Cmd-10         
                    d Cmd11           c                   const(x'3B')                         Cmd-11         
                    d Cmd12           c                   const(x'3C')                         Cmd-12         
                    d Cmd13           c                   const(x'B1')                         Cmd-13         
                    d Cmd14           c                   const(x'B2')                         Cmd-14         
                    d Cmd15           c                   const(x'B3')                         Cmd-15         
                    d Cmd16           c                   const(x'B4')                         Cmd-16         
                    d Cmd17           c                   const(x'B5')                         Cmd-17         
                    d Cmd18           c                   const(x'B6')                         Cmd-18         
                    d Cmd19           c                   const(x'B7')                         Cmd-19              
                    d Cmd20           c                   const(x'B8')                         Cmd-20              
                    d Cmd21           c                   const(x'B9')                         Cmd-21              
                    d Cmd22           c                   const(x'BA')                         Cmd-22              
                    d Cmd23           c                   const(x'BB')                         Cmd-23              
                    d Cmd24           c                   const(x'BC')                         Cmd-24              
                    d EnterKey        c                   const(x'F1')                                             
                    d RollUp          c                   const(x'F5')                         Roll Up             
                    d RollDown        c                   const(x'F4')                         Roll Down           
                                                                                                                   
                    
                    
                              write MSGCTL;                                                  
                              write fmt1;                                                    
                              exfmt SUB01CTL;                                                
                              $clearmsg('*' : *zero : *Blanks : '*ALL' : APIError);          
                              reset ScreenError;                                             
                              if Currec <> *Zeros;                                           
                               RRN1  =  Currec;                                              
                               SCRRN =  Currec;                                              
                              endif;                                                         
                                                                                             
                              select;                                                        
                           //                                                                
                           // F3 pressed end the program F3 = LeaveProgram                   
                        //                                                
                            when  Choice = LeaveProgram;                  
                             EndScreen1 = 'Y';                            
                                                                          
                        //                                                
                        // F6 pressed add/maintain note(s) to customer    
                        //    always default to TODAY!                    
                        //                                                
                            when  Choice = addnotes;                      
                             isodate =%date();                            
                             c3date = %dec(isodate:*mdy);                 
                             h3date = c3date;                             
                             exsr $addnotes;                              
                        //                                                
                        // F9 pressed email this note                     
                        //                                                
                            when  Choice = emailnote;                     
                             if where > *zeros;                           
                              chain where sub01;                          
                              if %found(arc19ad);                         
                                isodate = %date(h1cymd:*cymd);        
                                c3date = %dec(isodate:*mdy);          
                                s2code = 'CL';                        
                                exsr $clearsfl3;                      
                                exsr $loadsfl3;                       
                                exsr $clearsfl4;                      
                                exsr $loadsfl4;                       
                                exsr $screen4;                        
                               endif;                                 
                              endif;                                  
                                                                      
                         //                                           
                         // Enter Key pressed                         
                         //                                           
                             when  Choice = enterKey;                 
                              exsr $process;                          
                                                                      
                             endsl;                                   
                            enddo;
                    All my answers were extracted from the "Big Dummy's Guide to the As400"
                    and I take no responsibility for any of them.

                    www.code400.com

                    Comment


                    • #11
                      Re: Page at a time Subfile w/selection from multi sfl pages

                      Hello Jamief,

                      Thanks for the suggestion and for the hope that there is an answer after all. I have started working on capturing entry at pageup and pagedown...here is my dds and rpg (changes are in blue). Hex values for keys pressed are in a copy source and include x'F4' and x'F5'. Just tested and still only capturing current page of entry....
                      Looking at your suggestion in more detail....

                      DDS
                      Code:
                      A                                       DSPSIZ( 24 80 *DS3 )        
                      A                                       REF( SVFPGRP )  INDARA      
                      A                                       PRINT  MSGLOC( 9 )          
                      A                                       HELP(01)                    
                      A                                       CF01(01 'Help')     CF02(02)
                      A                                       CF03(03)  CF04(04)  
                      A                                       CF05(05 'Refresh')
                      A                                       CF06(06)  CF07(07)  CF08(08)
                      A                                       CF09(09)  CF10(10)  CF11(11)
                      A                                       CA12(12 'Cancel')           
                      A                                       CF13(13)  CF14(14)  CF15(15)
                      A                                       CF16(16)  CF17(17)  CF18(18)
                      A                                       CF19(19)  CF20(20)  CF21(21)
                      A                                       CF22(22)  CF23(23)  CF24(24)
                       ******                                                             
                      A          R DUMMY                      ASSUME                      
                      A                                  3  1 ' '                         
                       ******                                                             
                      A          R WINDOWRCD                  WINDOW( 3 21 20 55 )        
                      A                                       USRRSTDSP                   
                       ******                                                             
                      A          R SFLRCD                     SFL                       
                      A****        PGORGID   R        H                                 
                      A            PGORGID        5   H                                 
                      A            PGGNAM    R        H                                 
                                                                                        
                      A            SFLOPT         1   B  6  2                           
                      A N31                                   DSPATR( PC )              
                      A            PGGCOD    R        O  6  4 EDTCDE( 4 )               
                      A            PGGNAM42      42   O  6 13                           
                       ******                                                           
                      A          R SFLCTLRCD                  SFLCTL( SFLRCD )          
                      A                                       SFLSIZ( 11 )  SFLPAG( 11 )
                      A                                       WINDOW( WINDOWRCD )       
                      A                                       BLINK  KEEP  OVERLAY      
                      A                                       PAGEUP  PAGEDOWN          
                      A  72                                   SFLDSP                    
                      A  71                                   SFLDSPCTL                 
                      A  73                                   SFLCLR                    
                      A  76                                   SFLEND( *MORE )           
                      A                                       SFLCSRRRN( &CSRRRN )      
                      A            CSRRRN         5S 0H                                 
                                                                                        
                      A            WNDTITLE      53   O  1  2 DSPATR( HI )              
                      A            WNDPOSTXT     26   O  3  2                           
                      A            PGGNAMPOS     25   B  3 30 CHECK( LC )                 
                      A  31                                   DSPATR( PC )                
                                                                                          
                      A            WNDCHDLIN2    54   O  4  1 DSPATR( HI )                
                      A            WNDCHDLIN3    54   O  5  1 DSPATR( HI )                
                       ******                                                             
                      A          R CMDKEYRCD                  WINDOW( WINDOWRCD )         
                      A                                       BLINK  KEEP  OVERLAY        
                      A            WNDFKYLIN1    54   O 18  2 COLOR( BLU )                
                       ******                                                             
                      A          R RMVWINDOW                  CLRL( *NO )  OVERLAY  FRCDTA
                       ******                                                             
                      A          R MSGSFLRCD                  SFL  SFLMSGRCD( 19 )        
                      A            MSGKEY                     SFLMSGKEY                   
                      A            PGMMSGQ                    SFLPGMQ                     
                       ******                                                             
                      A          R MSGCTLRCD                  SFLCTL( MSGSFLRCD )         
                      A                                       WINDOW( WINDOWRCD )         
                      A                                       SFLSIZ( 9 )  SFLPAG( 1 )    
                      A                                       OVERLAY                     
                      A                                       SFLDSP  SFLDSPCTL  SFLINZ   
                      A  79                                   SFLEND                      
                      A            PGMQ                       SFLPGMQ
                      RPG
                      Code:
                      fSvfPGrp1  if   e           k Disk                               
                                                                                       
                      fSvfPGrpSS cf   e             WorkStn  InfDs ( FileStsDS )       
                      f                                      IndDs ( DspfIndicators )  
                      f                                      Sfile ( SflRcd  : CsrRRN )
                                                                                       
                      d FileStsDS       ds                 
                      d  FDSKeyPressed        369    369   
                      d  FDSCsrPostn          370    371b 0
                      [color="Blue"]d  FDSSflRRN            376    377I 0[/color]
                      
                      d DspfIndicators  ds            99  
                      d  SflNxtChgd             29     29n 
                      d  PostnCursor           31     31n 
                      d  SflDspCtl             71     71n 
                      d  SflDsp                72     72n 
                      d  SflClr                73     73n 
                      d  SflEnd                76     76n 
                      d  MsgSflEnd             79     79n 
                      
                       *  KeyPressed                                                       
                       *  This copies in the hex values used to determine which was pressed
                      d/copy qddssrc,hexfdefinit      
                      
                      c                   DoW       ( KeyPressed <> F03 )  and  
                      c                                 ( KeyPressed <> F12 )       
                                                                                
                      c                   ExSr      LoadSflPage                 
                                                                                
                      c                   DoW       ( KeyPressed <> F03 )  and  
                      c                                 ( KeyPressed <> F12 )       
                      c                   Eval      SflDspCtl   = True          
                      c                   Eval      SflDsp      = True          
                      c                   Eval      PgGNamPos   = *blanks       
                      c                   Write     WindowRcd                   
                      c                   Write     CmdKeyRcd                   
                      c                   Write     MsgCtlRcd                   
                      c                   ExFmt     SflCtlRcd                   
                      c                   Write     RmvWindow     
                      
                      c                   If        NbrRcdsInPg = *zero        
                      c                   Eval      RtnCde      = UserCancel   
                      c                   Return                               
                      c                   EndIf                                
                                                                               
                      c                   Eval      KeyPressed  = FDSKeyPressed
                      c                   Eval      CursorPostn = FDSCsrPostn  
                                                                               
                      c                   If        NbrRcdsInPg <> *zero       
                      c                   ExSr      ClrMsgSfl                  
                      c                   EndIf                                
                      c                   Eval      PostnCursor = False        
                                                                               
                      c                   Select                                             
                      c                   When      ( KeyPressed >= F01 )  and
                      c                             ( KeyPressed <= F24 )  or 
                      c                               KeyPressed  = Help      
                      c                   ExSr      PrcsCmdKey                
                                                                              
                      c                   If        ReBuildList               
                      c                   Eval      ReBuildList = False       
                      c                   Leave                               
                      c                   EndIf                               
                                                                              
                      c                   When      ( KeyPressed = Enter ) and
                      c                             ( PgGNamPos <> *blanks )  
                      [COLOR="Blue"]c                   ExSr      PrcsSelection[/COLOR]
                      c                   ExSr      PositionList              
                      c                   Leave                               
                                                                              
                      c                   When      KeyPressed  = PageUp      
                      c                   If        TopOfList                 
                      c                   Eval      MsgId       = 'DSP0132'   
                      c                   ExSr      LoadMsgSfl
                      c                   Else             
                      [COLOR="Blue"]c                   ExSr      PrcsSelection[/COLOR]   
                      c                   ExSr      PrcsPageUp
                      c                   Leave               
                      c                   EndIf
                      
                      c                   When      KeyPressed  = PageDown 
                      c                   If        BtmOfList              
                      c                   Eval      MsgId       = 'DSP0131'
                      c                   ExSr      LoadMsgSfl             
                      c                   Else 
                      [COLOR="Blue"]c                   ExSr      PrcsSelection[/COLOR]                            
                      c                   Eval      TopOfList   = False    
                      c                   Leave                            
                      c                   EndIf                            
                      
                      c                   Other                   
                      c                   ExSr      PrcsSelection 
                      c                   If        RcdWasSlctd   
                      c                   Return                  
                      c                   EndIf                   
                      c                   EndSl                   
                                                                  
                      c                   EndDo                   
                      c                   EndDo                   
                      
                      c                   Return    
                                  
                      c     LoadSflPage   BegSr                         
                                                                        
                      c                   ExSr      ClrSfl              
                      c                   Eval      SflOpt      = *blank
                      c                   Eval      SflEnd      = False 
                      c                   Eval      BtmOfList   = False 
                      c                   Eval      NbrRcdsInPg = *zero 
                                                                        
                      c                   DoW       NbrRcdsInPg < SflPag
                      c                   Read      rSvfPGrp            
                      c                   If        %eof ( SvfPGrp1 )   
                      c                   Eval      BtmOfList   = True           
                      c                   Eval      SflEnd      = True           
                      c                   EndIf                                  
                                                                                 
                      c                   If        BtmOfList                    
                      c                   Leave                                  
                      c                   EndIf                                  
                                                                                                                                c                   Eval      NbrRcdsInPg = NbrRcdsInPg + 1
                      c                   Eval      CsrRRN      = CsrRRN + 1     
                      c                   Write     SflRcd                       
                                                                                 
                       *  Save the keys for the top of this page and the last pag
                      c                   If        NbrRcdsInPg = 1              
                      c                   Eval      LastPagKFld = *blanks        
                      c                   If        KeyPressed  = PageDown       
                      c                   Eval      LastPagKFld = TopOfPgKFld    
                      c                   EndIf                                  
                      c                   Eval      TopOfPgKFld = PgGNam         
                      c                   EndIf                                  
                      c                   EndDo                            
                                                                           
                      c                   If        not BtmOfList          
                      c                   Read      rSvfPGrp               
                      c                   If        %eof ( SvfPGrp1 )      
                      c                   Eval      BtmOfList   = True     
                      c                   Eval      SflEnd      = True     
                      c                   Endif                            
                      c                   If        not BtmOfList          
                      c                   ReadP     rSvfPGrp               
                      c                   EndIf                            
                      c                   EndIf                            
                                                                           
                      c                   If        NbrRcdsInPg = *zero    
                      c                   ExSr      AddBlkSflRcd           
                      c                   Eval      SflEnd      = True     
                      c                   Eval      MsgId       = 'DSP0311'
                      c                   ExSr      SndNoRcdMsg            
                      c                   EndIf
                                               
                      c                   EndSr
                      
                      c     PrcsSelection BegSr                                
                                                                               
                      c                   Eval      RcdWasSlctd = False        
                      c                   Eval      PgGCodPrm   = *all'0'      
                      c                   Clear                   PgGCodSel    
                                                                               
                      c                   ReadC     SflRcd                     
                                                                               
                      c                   Eval      Index       = 1            
                                                                               
                      c                   DoW       not %eof ( SvfPGrpSS )     
                      c                   If        SflOpt     <> *blank       
                      c                   Eval      RcdWasSlctd = True         
                      c                   Eval      RtnCde      = GoodReturn   
                      [color="Blue"]c                   DoW       PgGCodSel( Index ) <> *zero 
                      c                   Eval      Index       = Index + 1     
                      c                   EndDo [/color]                                
                      c                   Eval      PgGCodSel( Index ) = PgGCod
                      c                   Eval      Index       = Index + 1    
                      c                   EndIf                                
                                                                               
                      c                   ReadC     SflRcd                     
                      c                   EndDo                                
                      c                   If        not RcdWasSlctd        
                      c                   Eval      MsgId       = 'DSP0281'
                      c                   Eval      MsgDtaA     = 'a'      
                      c                   Eval      MsgDtaB     = PrfGrpTxt
                      c                   ExSr      LoadMsgSfl             
                                                                           
                      c                   Else                             
                      c                   Eval      PgGCodPrm   = PgGCodDS 
                      c                   EndIf                            
                                                                           
                      c                   EndSr

                      Comment


                      • #12
                        Re: Page at a time Subfile w/selection from multi sfl pages

                        when pageup or pagedown

                        you have to use current RRN and chain to subfile to read
                        current meaning the first record on the current page

                        PHP Code:
                        for count 1 to #ofRecordsPerPage

                         
                        chain count subfile
                         
                        if %found

                          then lookup 
                        array 
                        update or write to array
                        blah blah blah....

                        endif

                        endfor 
                        All my answers were extracted from the "Big Dummy's Guide to the As400"
                        and I take no responsibility for any of them.

                        www.code400.com

                        Comment


                        • #13
                          Re: Page at a time Subfile w/selection from multi sfl pages

                          this is exactly where my mind was going....i'll get back to you when i've made the changes and tested

                          THANK YOU FOR THE HELP!! I figure there is a little more to it, I have to handle if the user changes their mind and changes a selection on other pages.

                          Comment


                          • #14
                            Re: Page at a time Subfile w/selection from multi sfl pages

                            and I like your 'lookup' suggestion...i will use it if it applies.

                            Comment


                            • #15
                              Re: Page at a time Subfile w/selection from multi sfl pages

                              it does apply cause there is always potential that user will remove, add of change an already entered selection while rolling back and forth so lookup would work sorta like this..

                              Code:
                                 if s1group > *zeros;                          
                                  dc## = %lookup(s1group : DCLgroup);          
                                  if dc## > *zeros;                            
                                   if s1cont <> *blanks;                       
                                    if s1cont <> DClcont(dc##);                
                                     DCLcount(dc##) +=1;                       
                                    endif;                                     
                                    DCLgroup(dc##) = s1group;                  
                                    DCLcont(dc##) = s1cont;                    
                                   endif;                                      
                                  else;                                        
                                   if s1cont <> *blanks;                       
                                    dc# +=1;                                   
                                    DCLcount(dc#) = 1;                         
                                    DCLgroup(dc#) = s1group;                   
                                    DCLcont(dc#) = s1cont;                     
                                   endif;                                      
                                  endif;                                       
                                 endif;
                              All my answers were extracted from the "Big Dummy's Guide to the As400"
                              and I take no responsibility for any of them.

                              www.code400.com

                              Comment

                              Working...
                              X