ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Position to with Load All Subfile

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

  • Position to with Load All Subfile

    The current situation is your basic subfile, 12 lines per page. (1-12, 13-24, 25-36, etc. )

    Is there a way to "position" the subfile to start at a desired line number? Example: the user enters a 6, it would display 6-17.

    The other option is to do a page at a time sfl but the program does other stuff which makes this option unappealing. (I won't bore you with the details.)
    http://www.linkedin.com/in/chippermiller

  • #2
    Re: Position to with Load All Subfile

    You can save the 6 (or whatever line they want) and then reposition using the rrn.
    Your future President
    Bryce

    ---------------------------------------------
    http://www.bravobryce.com

    Comment


    • #3
      Re: Position to with Load All Subfile

      your going to have to store the subfile in array/data structures or my favorite a temporary global file .... any way when the user enters a number like 57..

      then you read thru the array and when you hit 58 you start writting the subfile.


      jamie
      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


      • #4
        Re: Position to with Load All Subfile

        like this sorta

        dds
        Code:
           
             A*%%EC
             A                                      DSPSIZ(24 80 *DS3)
             A                                      REF(*LIBL/LBAFREF)
             A                                      PRINT
             A**************************************************************************
             A          R SUB01                     SFL
             A*%%TS  SD  20070622  104425  FLANARY     REL-V5R4M0  5722-WDS
             A            S1FIELD1      30A  O  9 12
             A            S1OPT          1A  B  9  7
             A**************************************************************************
             A          R SUB01CTL                  SFLCTL(SUB01)
        
             A                                      SFLSIZ(0014)
             A                                      SFLPAG(0005)
             A                                      CF03(03)
             A                                      RTNCSRLOC(&#REC &#FLD &#POS)
             A  99                                  ALARM
             A                                      OVERLAY
             A                                      SFLCSRRRN(&WHERE)
             A  31                                  SFLDSP
             A  32                                  SFLDSPCTL
             A  30                                  SFLCLR
             A  33                                  SFLEND(*MORE)
             A            SCRRN          4S 0H      SFLRCDNBR
             A                                  1  2DATE
             A                                      EDTCDE(Y)
             A                                  1 12TIME
             A            C1COMPANY     30A  O  1 26DSPATR(HI)
             A            C1TITLE       40A  O  2 21DSPATR(HI)
             A                                  5  4'Type options, press Enter'
             A                                      COLOR(BLU)
             A            HDPROGRAM     10A  O  1 71
             A            #REC          10A  H
             A            #FLD          10A  H
             A            #POS           4S 0H
             A            WHERE          5S 0H
             A                                  6  6'2=Edit'
             A                                      COLOR(BLU)
             A                                  6 14'3=Copy'
             A                                      COLOR(BLU)
             A                                  6 23'5=Display'
             A                                      COLOR(BLU)
             A                                  8 12'Some data'
             A                                      DSPATR(HI)
             A                                      DSPATR(UL)
             A                                  8  6'Opt'
             A                                      DSPATR(HI)
             A                                      DSPATR(UL)
             A            C1RRN          2Y 0B  4 10EDTCDE(Z)
             A                                  4  5'RRN:'
             A**************************************************************************
             A          R FKEY01
             A*%%TS  SD  20070331  132959  FLANARY     REL-V5R3M0  5722-WDS
             A                                 23  2'F3=Exit'
             A                                      COLOR(BLU)
        RPG

        Code:
              //---------------------------------------------------
              // Program -
              // Purpose - subfile position RRN
              // Written - xx/xx/xx
              // Author  - xxxxxxxxxxxxxxxxxxxx
              //
              // INPUT PARAMETERS
              //   Description        Type  Size    How Used
              //   -----------        ----  ----    --------
              //
              // INDICATOR USAGE
              //   03 - leave
              //---------------------------------------------------
             fDROP2AD   cf   e             workstn INFDS(INFDS)
             f                                     SFILE(SUB01:RRN1)
        
              // Data Structures
             d Infds           ds                                                       INFDS data structure
             d Currec                378    379B 0
              //
              // Program Info
              //
             d                SDS
             d  @PGM                 001    010
             d  @PARMS               037    039  0
             d  @MSGDTA               91    170
             d  @MSGID               171    174
             d  @JOB                 244    253
             d  @USER                254    263
             d  @JOB#                264    269  0
              //
              // Variables
              //
        
             d Normal          c                   X'20'
             d Red             c                   X'28'
             d White           c                   X'22'
             d Blue            c                   X'3A'
             d Pink            c                   X'38'
        
             d @Scrn1          s              1
             d count           s              4  0
             d count2          s              4  0
             d EndScreen1      s              1    inz('N')
             d RRN1            s                   like(SCRRN)
             d Savrrn          s                   like(SCRRN)
             d ScreenError     s              1    inz('N')
             d writesome       s              4  0
              //
              // Break apart the time stamp
              //
              //---------------------------------------------------
              //       C a l c u l a t i o n  S p e c s
              //---------------------------------------------------
              /free
               exsr $Screen1;
               *INLR = *on;
        
               //===========================================
               //  $Screen1 - Display all parts allow for
               //             Search.
               //===========================================
               begsr $Screen1;
                 //
                 reset EndScreen1;
                 dow EndScreen1 = 'N';
        
                   exfmt SUB01CTL;
        
                   if Currec <> *Zeros;
                     RRN1    =  Currec;
                     SCRRN   =  Currec;
                   endif;
        
                   reset ScreenError;
        
                   select;
                     // F3 pressed end the program F3 = LeaveProgram
                    when *in03;
                     EndScreen1 = 'Y';
        
                    other;
                     if c1RRN <> *zeros;
                      exsr $ClearSFL;
                      exsr $LoadSFL;
                      clear c1rrn;
                     endif;
        
                   endsl;
        
                 enddo;
        
               endsr;
               //===========================================
               // $Process - Process the subfile(1)
               //===========================================
               begsr $Process;
        
        
               endsr;
               //===========================================
               //  $ClearSFL- Clear the route error sub
               //===========================================
               begsr $clearsfl;
        
                 *in31  = *Off;
                 *in32  = *Off;
                 *in30  = *On;
        
                 write SUB01CTL;
        
                 *in31  = *On;
                 *in32  = *On;
                 *in30  = *Off;
        
                 clear RRN1;
                 clear SCRRN;
                 clear SavRrn;
        
                 *in33 = *off;
                 clear count;
               endsr;
        
               //===========================================
               //  $LoadSfl  - Load up the route errors
               //===========================================
                begsr $loadsfl;
        
                 if SavRrn  > *Zeros;
                  rrn1  = savrrn;
                  scrrn = savrrn;
                 endif;
                 //
                       dou writesome = 25;
                        writesome +=1;
                        exsr $kindaFile;
                        if c1rrn = *zeros or
                           writesome >= c1rrn;
                         RRN1  +=1;
                         SCRRN  = RRN1;
                         write SUB01;
                        endif;
                       enddo;
                       clear Writesome;
                 //
                 *in33 = *on;
                 savrrn = scrrn;
        
                 //
                 //  If no records in subfile then do not disply the subfile.
                 //
        
                 if SavRrn  = *zeros;
                   *in31 = *off;
                 else;
                   rrn1  = 1;
                   scrrn =  1;
                 endif;
        
                 //
               endsr;
               //===========================================
               //  $KindaF le - this is sorta a file
               //===========================================
                begsr $KindaFile;
                  count +=1;
                  s1field1 = 'I Like Pizza -' +  %char(count);
                endsr;
               //=================================================
               //  *inzsr - One time run processing
               //=================================================
               begsr *inzsr;
        
                 exsr $ClearSFL;
                 exsr $LoadSFL;
        
               endsr;
        
              /end-free
        Attached Files
        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


        • #5
          Re: Position to with Load All Subfile

          Originally posted by jamief View Post
          your going to have to store the subfile in array/data structures or my favorite a temporary global file .... any way when the user enters a number like 57..

          then you read thru the array and when you hit 58 you start writting the subfile.


          jamie
          Yeah, it looks like there's not really an easy way to do this. I've gone the "subfile in an array/data structure route" when I had to do simulated side by side subfiles. (Our remote offices are at *yuck* 9600 baud and windows are extremely slow.)

          I'm on the iSeries Information Center now -- I might be able to do something using a combination of sflrcdnbr(*top) & sflscroll.
          Last edited by Chipper; December 13, 2007, 03:29 PM. Reason: Replace sflcsrrrn(*top) with sflrcdnbr(*top)
          http://www.linkedin.com/in/chippermiller

          Comment


          • #6
            Re: Position to with Load All Subfile

            Originally posted by jamief View Post
            like this sorta


            Thanks! I haven't had a chance to go thru in detail, but that might do the trick.
            http://www.linkedin.com/in/chippermiller

            Comment


            • #7
              Re: Position to with Load All Subfile

              Hi,

              try the following:
              DDS
              PHP Code:
              A                                      SFLCSRRRN(&C1RSNR)               
              A                                      SFLMODE(&C1MODE)                 
              A  57                                  SFLDSP                           
              A  56                                  SFLDSPCTL                        
              A  58                                  SFLCLR                           
              A  59                                  SFLEND
              (*MORE)                    
              A                                      SFLSIZ(9999)                     
              A                                      SFLPAG(0012)                     
              A            C1RSF          4S 0H      SFLRCDNBR(CURSOR *TOP
              Programm:
              PHP Code:
               /Free
                   
              If DSPFPos <> *Zeros and DSPFPos <= MaxSflRcd;
                      
              C1RSF DspFPos;
                   ElseIf 
              C1RSNR <> *Zeros;
                      
              C1RSF C1RSNR;
                   Else;
                      
              C1RSF 1;
                   EndIf;
                   
              ExFmt SflCtl;
               /
              End-Free 
              Birgitta
              Last edited by B.Hauser; December 14, 2007, 12:14 AM.

              Comment


              • #8
                Re: Position to with Load All Subfile

                Thanks Brigitta! I did some experimentation yesterday and that's similar to what I did, but your feedback may help me "tweak" things a bit.
                http://www.linkedin.com/in/chippermiller

                Comment


                • #9
                  Re: Position to with Load All Subfile

                  I knew there had to be an easier way with rrn than rewriting the file to a DTA. Haven't we discussed this before? I think I've tried this before, but i'm too busy and lazy to look right now.
                  Your future President
                  Bryce

                  ---------------------------------------------
                  http://www.bravobryce.com

                  Comment

                  Working...
                  X