ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

sub file type?

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

  • sub file type?

    pls say which type of subfile is this ? single page . page by page sub file .... or! ??

    i can load more than 9999 record to this subfile without error but if i press more than 9999 times page down button - subfile is dump!

    Code:
         H DEBUG DATEDIT(*YMD) TIMFMT(*HMS)
         FPAY01L00  IF   E           K DISK
         FTESTSUB01 CF   E             WORKSTN INFDS(WSDS)
         F                                     SFILE(SFL:SFLRN)
         D @F01            C                   CONST(X'31')
         D @F02            C                   CONST(X'32')
         D @F03            C                   CONST(X'33')
         D @F04            C                   CONST(X'34')
         D @F05            C                   CONST(X'35')
         D @F06            C                   CONST(X'36')
         D @F07            C                   CONST(X'37')
         D @F08            C                   CONST(X'38')
         D @F09            C                   CONST(X'39')
         D @F10            C                   CONST(X'3A')
         D @F11            C                   CONST(X'3B')
         D @F12            C                   CONST(X'3C')
         D @F13            C                   CONST(X'B1')
         D @F14            C                   CONST(X'B2')
         D @F15            C                   CONST(X'B3')
         D @F16            C                   CONST(X'B4')
         D @F17            C                   CONST(X'B5')
         D @F18            C                   CONST(X'B6')
         D @F19            C                   CONST(X'B7')
         D @F20            C                   CONST(X'B8')
         D @F21            C                   CONST(X'B9')
         D @F22            C                   CONST(X'BA')
         D @F23            C                   CONST(X'BB')
         D @F24            C                   CONST(X'BC')
         D @CLEAR          C                   CONST(X'BD')
         D @ENTER          C                   CONST(X'F1')
         D @HELP           C                   CONST(X'F3')
         D @PAGUP          C                   CONST(X'F4')
         D @PAGDN          C                   CONST(X'F5')
         D @PRINT          C                   CONST(X'F6')
          *
          **----------------------------------------------------------------*
          ** Standard include for all interactive programs                  *
          ** Defines standard constants                                     *
          **================================================================*
          *
         D @FALSE          C                   CONST('0')
         D @TRUE           C                   CONST('1')
         D @FOLD           C                   CONST('0')
         D @DROP           C                   CONST('1')
          *
          **----------------------------------------------------------------*
          ** Standard include for all interactive programs                  *
          ** display file information data structure                        *
          **================================================================*
          *
         D WSDS            DS
          **              Identifies the key pressed
         D  KEY                  369    369
         D  PAGRRN               378    379B 0
         D  CURSOR               370    371B 0
         D                 DS                  INZ
          **              Identifies the subfile page rrn
         D  STKCNT                 1      4B 0
         D  DTALEN                 5      8B 0
         D  ERRCOD                 9     12B 0
          **              GET Local user ID.
         D                SDS
         D USER                  254    263
          *
          **----------------------------------------------------------------*
          ** Body of the program                                            *
          **================================================================*
          *
         C                   Reset                   @Exit
         C                   Reset                   SFMODE
         C                   Exsr      @Reset
         C                   Move      @FALSE        *IN99
         C     *LOVAL        Setll     PAY01R
         C                   READ      PAY01R
         C                   Exsr      @Load
         C                   Exsr      Msfsnd
         C                   If        NOT %EOF(PAY01L00)
         C                   Eval      *IN99 = @false
         C                   Endif
          *
         C*
         C*
         C     @EXIT         DOWEQ     @FALSE
         C                   Write     SFLHDR
         C                   Write     SFLCMD
         C                   Write     MSGCTL
         C                   EXFMT     SFLCTL
         C                   Exsr      Msfclr
         C                   EVAL      SFLPS = PAGRRN
          *
         C     KEY           CASEQ     @F03          @F03SR
         C     KEY           CASEQ     @F05          @F05SR
         C     KEY           CASEQ     @F06          @F06SR
         C     KEY           CASEQ     @F12          @F12SR
         C     KEY           CASEQ     @PAGDN        @PgDown
         C     KEY           CASEQ     @ENTER        @Entky
         C                   ENDCS
         C                   ENDDO
         C                   Eval      *INLR = @TRUE
          *
         C     *INZSR        BEGSR
         C                   Move      @False        @Exit             1
         C                   Z-add     0             SFLRN             4 0
         C                   Z-add     0             ENDRN             4 0
         C                   Z-add     1             SFLPS
         C                   Move      @DROP         SFMODE
         C                   Move      'PAY0000'     Msgid
         C                   Movel     'PAYMSGF '    Msgf             20
         C                   Movel     '*LIBL'       Msglib           10
         C                   Move      Msglib        Msgf
         C                   Move      *Blanks       Msgdta           80
         C                   Movel     '*DIAG'       Msgtyp           10
         C                   Movel     '*'           Pgmq
         C                   Move      *Blanks       Msgky             4
         C                   Movel     '*ALL'        Msgrmv           10
          *
         C                   ENDSR
         C     Msfsnd        Begsr
          *
         C                   Call      'QMHSNDPM'
         C                   Parm                    Msgid             7
         C                   Parm                    Msgf
         C                   Parm                    Msgdta
         C                   Parm                    Dtalen
         C                   Parm                    Msgtyp
         C                   Parm                    Pgmq
         C                   Parm                    Stkcnt
         C                   Parm                    Msgkey
         C                   Parm                    Errcod
         C                   Move      *Blanks       Msgdta
         C                   Z-add     *Zeros        Dtalen
          *
         C                   Endsr
          *
          **----------------------------------------------------------------*
          ** Clear message subfile                                          *
          **================================================================*
          *
         C     Msfclr        Begsr
          *
         C                   CALL      'QMHRMVPM'
         C                   Parm                    Pgmq
         C                   Parm                    Stkcnt
         C                   Parm                    Msgky
         C                   Parm                    Msgrmv
         C                   Parm                    Errcod
          *
         C                   Endsr
          *
          **----------------------------------------------------------------*
          ** @Reset Subroutine                                              *
          **================================================================*
          *
         C     @Reset        Begsr
         C                   Move      @TRUE         *In40
         C                   Write     SFLCTL
         C                   Move      @FALSE        *In40
         C                   Move      @FALSE        *In42
         C                   Reset                   SFLRN
         C                   Reset                   ENDRN
         C                   Endsr
          *
          **----------------------------------------------------------------*
          ** @Load  Subroutine                                              *
          **================================================================*
          *
         C     @Load         Begsr
         C                   Z-add     SFLRN         SFLPS
         C                   Eval      SFLPS = SFLPS +1
         C                   DO        15
          *
         C                   If        %EOF(PAY01L00)
         C                   Eval      *IN99 = @TRUE
         C                   Leave
          *
         C                   Else
         C                   Eval      Optd = *Blanks
         C                   Eval      Empno01D = Empno01
         C                   Eval      Name01D  = Name01
         C                   Eval      SFLRN = SFLRN +1
         C                   Write     SFL
         C                   Endif
         C                   Read      PAY01R
         C                   ENDDO
         C                   Eval      ENDRN = SFLRN
         C                   If        SFLRN = *zeros
         C                   Eval      *IN42 = @FALSE
         C                   Write     NOREC
         C                   else
         C                   Eval      *IN42 = @TRUE
          *pageup....
         C                   If        SFLPS > SFLRN
         C                   Eval      SFLPS = SFLRN
         C                   Endif
         C                   Endif
          *
         C                   Endsr
          *
         C     @F03SR        Begsr
         C                   EVAL      @EXIT ='1'
         C                   Endsr
         C     @F12SR        Begsr
         C                   EVAL      @EXIT ='1'
         C                   Endsr
          *
         C     @Entky        Begsr
         C                   If        EMPNO01DT <> 0
         C                   Eval      *IN99 = @false
         C     EMPNO01DT     Setll     PAY01R
         C                   READ      PAY01R
         C                   Eval      EMPNO01DT = 0
         C                   Exsr      @Refresh
         C                   else
          *
         C                   if        CSRPOS <> 0
         C                   z-add     csrpos        sflps
         C                   endif
          *
          *select options value
          *
         C                   z-add     *zeros        SUBNUM            4 0
         C                   z-add     ENDRN         SUBREC            4 0
         C                   move      '0'           MSGSTAT           1
         C                   DO        SUBREC
         C                   ADD       1             SUBNUM
         C     SUBNUM        CHAIN     SFL
         C                   if        optd <> *blanks
         C                   z-add     SUBNUM        SFLPS
         C                   endif
          *
         C                   if        (optd = ' 2') or (optd ='2')
         C                   call      'MAIN2'
         C                   PARM                    EMPNO01D
         C                   endif
         C                   if        (optd <>' 2') or (optd<>'2')
         C                   move      '1'           msgstat
         C                   endif
         C                   enddo
         C                   if        msgstat = '1'
         C                   move      'PAY0001'     msgid
         C                   exsr      msFsnd
         C                   endif
         C                   endif
         C
         C                   Endsr
          *
         C     @PgDown       Begsr
         C                   If        Not %EOF(PAY01L00)
         C                   eval      *in99 = @false
         C                   Eval      XROW = 0
         C                   Eval      XCOL = 0
         C                   Eval      SFLRN = ENDRN
         C                   Exsr      @Load
         c                   else
         C                   eval      *in99 = @true
         C                   endif
         C                   Endsr
          *
         C     @Refresh      Begsr
         C                   Eval      SFLRN = 0
         C                   Eval      ENDRN = 0
         C                   Eval      SFLPS = 1
         C                   Move      @DROP         SFMODE
         C                   Reset                   @EXIT
         C                   Reset                   SFMODE
         C                   Exsr      @Reset
         C                   Exsr      @Load
         C                   endsr
          *
         C     @F05SR        Begsr
         C                   Eval      *IN99 = @false
         C     *LOVAL        Setll     PAY01R
         C                   READ      PAY01R
         C                   Eval      EMPNO01DT = 0
         C                   Exsr      @Refresh
         C                   Endsr
          *
         C     @F06SR        Begsr
          *                  call      'TEST02R'
         C                   Endsr
    thanks
    dhanuxp
    Last edited by dhanuxp; April 25, 2008, 04:05 AM.

  • #2
    Re: sub file type?

    Did you really press PageDn key 9999 times ???
    Philippe

    Comment


    • #3
      Re: sub file type?

      if i press more than 9999 times page down button- subfile is dump!
      how you came to know that its not working after 9999 times?

      once you check the 'number of records' specified in your display file.
      Thanks,

      Abhishek KUMAR

      Comment


      • #4
        Re: sub file type?

        it could be either.........the way to tell is in the DDS.
        but since you said you paged down 9999 times cause
        you had nothing better to do I can say its a load a page at a time.

        otherwise it would have blown up cause the number of records in
        PAY01L00 is greater than 9999.

        this most likely load all (but not definetly)
        Code:
        A                                      SFLSIZ(0016)           
        A                                      SFLPAG(0014)
        This is a page at a time....
        Code:
        A                                      SFLSIZ(0016)           
        A                                      SFLPAG(0016)
        That said.........unless you clear the subfile every time and reload
        from RRN1 to ?????? on every pageup/pagedown
        then either of the two types will blow up at 9999
        cause RRN is 4.0 decimal field and being a math genius
        if you add 1 to 9999 in a four decimal field then you get 0000
        and KAPOW!
        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: sub file type?

          Also, please note that you can not have a subfile that is larger than 9999. But more importantly, you should not. No user is going to look at 10000 records for the one they want.
          Hunting down the future ms. Ex DeadManWalks. *certain restrictions apply

          Comment


          • #6
            Re: sub file type?

            Originally posted by jamief View Post

            That said.........unless you clear the subfile every time and reload
            from RRN1 to ?????? on every pageup/pagedown
            then either of the two types will blow up at 9999
            cause RRN is 4.0 decimal field and being a math genius
            if you add 1 to 9999 in a four decimal field then you get 0000
            and KAPOW!
            yes this is the problem?


            Code:
            A                                      SFLSIZ(0016)           
            A                                      SFLPAG(0014)
            i create this type of dds for my subfile


            thanks
            dhanuxp

            Comment


            • #7
              Re: sub file type?

              Originally posted by DeadManWalks View Post
              Also, please note that you can not have a subfile that is larger than 9999. But more importantly, you should not. No user is going to look at 10000 records for the one they want.
              so cant we avoid above limitation?

              Comment


              • #8
                Re: sub file type?

                Originally posted by Mercury View Post
                Did you really press PageDn key 9999 times ???
                LOL. I was wondering the same thing.

                Comment


                • #9
                  Re: sub file type?

                  Originally posted by dhanuxp View Post
                  so cant we avoid above limitation?
                  9999 is the hard limit on the number of records. If you want your user to be able to scroll through more than 9999 records, you will not be able to use the expanding subfile. You will have to load each page in your programming instead of letting the subfile control it. Depending on your data and use, this can be relatively easy or complex. If the data is a single file read for inquiry only with a simple key, then you just keep track of the key for the first record of each page and keep track of what page you are on and whether the roll up or roll down was pressed.

                  This can be quite complex when multiple files, filtering and add/update/delete are added, but the core concept is the same, you have to keep track of where in the data you will need to go if the roll down button (page up) is pressed since this is kept track of for you in an expanding subfile, but not in a page by page load.
                  Goodbye

                  Comment


                  • #10
                    Re: sub file type?

                    I know there will be uproar to this reply, but here goes anyway.

                    To have a SFL with more than 9999 records (as it will appear to the user), i believe the following will work and is not difficult to implement... just requires a little concentration.

                    1. In your DDS, create more than 1 subfile and related (field names may remain the same)
                    2. IN your RPG, duplicate and rename all your SFL indicators and counters. eg. SFLRRN becomes SFLRRN1, SFLRRN2, SFLRRN3 etc
                    3. When SFLRRN1 = 9999, start writing to and displaying the 2nd SFL. Remember to use the correct indicators from now on.
                    4. On PgUp/PgDn, you have control over which SFL to display anyway, so that shouldn't pose a problem.

                    Having said all that, I agree with what was previously said in this thread by DMW, dhanuxp and others, i.e. no user is gonna page up & down so many times (although i think we do have one here that would try it just to find out what happens, and then complain about it).

                    Personally, I try display a max of 1000 recs. If there is a chance that more could be displayed, I built a filter onto the first input screen. when 1000 is reached I display to the user to redefine their selection.
                    Regards

                    Kit
                    http://www.ecofitonline.com
                    DeskfIT - ChangefIT - XrefIT
                    ___________________________________
                    There are only 3 kinds of people -
                    Those that can count and those that can't.

                    Comment


                    • #11
                      Re: sub file type?

                      I mentioned the method to make this work....

                      unless you clear the subfile every time and reload
                      from RRN1 to ?????? on every pageup/pagedown
                      this does add a BUNCH of overhead to your program...
                      if you clear your subfile and reload each time then you must save
                      any previous selection(s) (an array maybe)
                      IMHO .... this extra work is not required.

                      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


                      • #12
                        Re: sub file type?

                        Why not do an "info" check (Select Count(*) from) before you start loading and tell the user they're retrieving more than 10,000 records and to please refine their search? Or, put a hard limit on it to say 5,000 records if you have to. I agree with the sentiment that more than 1k - 3k records is enough for anyone to scroll through, especially at 15 records per page.

                        Comment


                        • #13
                          Re: sub file type?

                          Actually, it's the Google-ization of mankind...

                          Who looks at anything beyond the first 3 pages? If it's not found by then, one loses interest and redefines the search anyway.

                          To quote Jamie
                          (that attention span thing caused by fast food & the internet )
                          http://www.code400.com/forum/showpos...3&postcount=13
                          Last edited by kitvb1; April 28, 2008, 10:02 AM.
                          Regards

                          Kit
                          http://www.ecofitonline.com
                          DeskfIT - ChangefIT - XrefIT
                          ___________________________________
                          There are only 3 kinds of people -
                          Those that can count and those that can't.

                          Comment


                          • #14
                            Re: sub file type?

                            Originally posted by Mercury View Post
                            Did you really press PageDn key 9999 times ???
                            hi

                            for what??? i initialize 9996, and press 4 time pagdn!

                            dhanuxp

                            Comment


                            • #15
                              Re: sub file type?

                              Originally posted by kitvb1 View Post

                              1. In your DDS, create more than 1 subfile and related (field names may remain the same)
                              2. IN your RPG, duplicate and rename all your SFL indicators and counters. eg. SFLRRN becomes SFLRRN1, SFLRRN2, SFLRRN3 etc
                              3. When SFLRRN1 = 9999, start writing to and displaying the 2nd SFL. Remember to use the correct indicators from now on.
                              4. On PgUp/PgDn, you have control over which SFL to display anyway, so that shouldn't pose a problem.
                              bit hard kit, but hope to try it

                              thanks
                              dhanuxp

                              Comment

                              Working...
                              X