sponsored links

Collapse

Announcement

Collapse
No announcement yet.

Another SubFile Auto Refresh Question

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

  • Another SubFile Auto Refresh Question

    Hi,

    I've read the entire thread on how to program a subfile with auto refresh.

    Yet, I can't get my code to work. (Before I made these changes to accomodate the subfile auto refresh, my subfile worked fine.)

    I have changed the DDS to include INVITE and WAITRCD(30). My RPG includes KNUM 1 and I no longer use EXFMT. I use WRITE with the subfile control record format. I use READ with the display file name. I can see that the STATUS code returned by the program data structure does indeed indicate a timeout (1331).

    OK so far, except when the subfile is displayed it is blank. I've walked the code with the debugger and it appears recs are being written to the subfile control rec format, the subfile RRN is 4 after my load SF routine. (There are only 4 recs in the DB I am reading.)

    Any idea why my SubFile does not display any records?

    TIA,
    Dave

  • #2
    Re: Another SubFile Auto Refresh Question

    Dave,

    Take a look at the subfile display indicator.
    My guess would be that its *OFF ....Or somehow you are no
    longer populating the subfile field names with your file names.

    It would be easier to believe that SFLDSP is *OFF

    If you like post some of the code.

    thanks
    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


    • #3
      Re: Another SubFile Auto Refresh Question

      Jamie,

      Thanks for the reply. I appreciate any help you can provide.

      Here's the display file:
      PHP Code:
      A                                      DSPSIZ(24 80 *DS3)         
      A                                      INVITE                     
      A                                      WDWBORDER
      ((*COLOR WHT) (*CH
      A                                      
      | = '))                    
      A                                      PAGEDOWN(75)               
      A                                      CF03(03 '
      EXIT')            
      A                                      CF16(16 '
      SORT COLUMN')     
      A                                      CF10(10 '
      ADD A NEW REC')   
      A                                 23  6'
      F3-Exit'                  
      A                                 22  6'
      --------------------C O M 
      A                                        K E Y S
      ------------------
      A                                 23 55'F16-Sort By Column'       
      A          R EMERSFL                   SFL                        
      A
      *%%TS  SD  20060805  214719  QSECOFR     REL-V3R2M0  5763-PW1    
      A            MCWRKN    R        O  8  9REFFLD
      (RWRKORD/MCWRKN FLIBH
      A            MCFUNC    R        O  8 16REFFLD
      (RWRKORD/MCFUNC FLIBH
      A            ACCT      R        O  8 21REFFLD
      (RWRKORD/ACCT FLIBHH/
      A            MCENDT    R        O  8 30REFFLD(RWRKORD/MCENDT FLIBH
      A            MCDETL    R        O  8 40REFFLD
      (RWRKORD/MCDETL FLIBH
      A            FENAME    R        O  8 61REFFLD
      (RWRKORD/FENAME FLIBH
      A            INPUT          1   I  8  5                           
      A          R EMERCTL                   SFLCTL
      (EMERSFL)            
      A*%%TS  SD  20060803  112504  QSECOFR     REL-V3R2M0  5763-PW1    
      A                                      SFLSIZ
      (0013)               
      A                                      SFLPAG(0012)               
      A                                      OVERLAY                    
      A  50                                  SFLDSP                     
      A                                      SFLDSPCTL                  
      A  49                                  SFLCLR                     
      A  99                                  SFLEND
      (*MORE)              
      A            SFLRRN         4S 0H                                 
      A            POSDTL        20A  B  6 40CHANGE
      (77)                 
      A  24                                  DSPATR(HI)                 
      A            POSTO         20A  O  4 44DSPATR(HI)                 
      A                                  2 20'2-Change'                 
      A N11                                  DSPATR(ND)                 
      A                                  4 20'Position to and Select:'  
      A                                      DSPATR(HI)                 
      A                                  1 27'Open Emergency Work Orders
      A                                  7 40'
      Problem             '     
      A                                      DSPATR(UL)                 
      A                                  7 61'
      Employee Assigned   '     
      A                                      DSPATR(UL) 
      Here's the RPG:

      PHP Code:
      FWRKORE  IF  E           K        DISK                            
      FWRK250FMCF  E                    WORKSTN                         
      F                                              KINFDS SFLE        
      F                                        SFLRRNKSFILE EMERSFL     
      F                                              KNUM        1      
       
      *****************************************************************
      ISFLE        DS                                                   
      I                                     
      *STATUS  STATUS             
       
      Cursor Position                                                
      I                                    B 370 3710CURPOS             
       
      *****************************************************************
       *                      
      MAINLINE                                 *
       *****************************************************************
      C                     EXSR LOADSF                     Load SubFile
      C                     READ WRK250FM               8687            
      C           
      *ON       IFEQ *IN87                                  
      C           STATUS    IFEQ 01331                                  
      C                     EXSR LOADSF                                 
      C                     READ WRK250FM               8687            
      C                     
      ENDIF                                       
      C                     ENDIF                                       
       *                                                                
      C                     MOVE '1'       *INLR                       3
       
      *****************************************************************
       * 
      LOADSF Loads the subfile with the entire contents of WRKORE
       *****************************************************************
      C           LOADSF    BEGSR                                       
      C                     RESETCTR                        initalize ct
       
      *                                                                
      C                     Z-ADD12        SFLRCS  20                   
      C                     READ WRKORE                   30            
      C           
      *IN30     DOWEQ*OFF                       Not EOF     
      C           CTR       ANDLTSFLRCS                     don
      't rd 2 m
      C                     ADD  1         CTR     20                   
      C                     ADD  1         SFLRRN           subfile RRN 
      C                     WRITEEMERCTL                    write subfil
      C                     READ WRKORE                   30            
      C                     ENDDO                                       
       *                                                                
       *                                                                
      C           CTR       IFGT *ZERO                      recs written
       * IN50 controls SFLDSP and SFLDSPCTL                             
      C                     MOVE *ON       *IN50                        
      C                     ELSE                                        
      C                     MOVE *OFF      *IN50            no recs to d
      C                     END                             CTR > 0     
       *                                                                
      C                     ENDSR 

      Comment


      • #4
        Re: Another SubFile Auto Refresh Question

        I dont see you setting on *in49 and clearing the subfile.

        I also donot see when reloading you settll to *start (record one) of the physical file.

        I see you have also used the same dds name as the physical file name.
        THought this is easier to code and looks cleaner...I like to name my DDS
        field names different. (but at this point that is not your problem)
        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: Another SubFile Auto Refresh Question

          Jamie,

          > I dont see you setting on *in49 and clearing the subfile.
          The code that I posted is a "stripped" down version of the program I am working on. The code includes only the portions that are related to getting this subfile to auto refresh.

          >I also donot see when reloading you settll to *start (record one) of the physical file.
          While a good practice, I don't believe that you need to SETLL when the PF is first opened.

          I changed the code that I posted, eliminating the KNUM 1, switching the WRITE/READ back to a EXFMT, omitted the INVITE from the DDS and didn't specify the WAITRCD parm when compiling the DDS. The program worked fine, displaying the 4 recs that are in the DB and then ending. Therefore, I believe that this darn code should work with the auto refresh implementation.

          I'm stumped......

          TIA,
          Dave

          Comment


          • #6
            Re: Another SubFile Auto Refresh Question

            Hi prowak:

            If you read the 4 records in the first pass you are at end-of-file. On the second pass (refresh) you are going to have to re-set back to *start otherwise you are reading beyond EOF

            Thanks
            GLS
            The problem with quotes on the internet is that it is hard to verify their authenticity.....Abraham Lincoln

            Comment


            • #7
              Re: Another SubFile Auto Refresh Question

              The initial view of the subfile should display the 4 recs that are in the DB, no?

              I never see any records.

              Dave

              Comment


              • #8
                Re: Another SubFile Auto Refresh Question

                Hi prowak:

                Your code is a little confusing. In the loadsf sub-routine you are writeing the control record....Not the sub file record.

                I don't see where you are writeing the control record but that should be before the read.

                It's difficult to tell but I think you should be testing for *in86 (low) after the read not *in87 (equal).

                Once you get the status error (1331) you need to loop back to the top read so the status will be re-tested ..... (the second refresh)

                Try those changes and let me know how it works

                Thanks
                GLS
                Last edited by GLS400; August 22nd, 2006, 06:58 AM.
                The problem with quotes on the internet is that it is hard to verify their authenticity.....Abraham Lincoln

                Comment


                • #9
                  Solved - Another SubFile Auto Refresh Question

                  Hi,

                  Thanks for the replies. In an effort to replace the EXFMT with a WRITE and then a READ, I was confusing the need for the WRITE of the control rec format with the WRITE that occurs as you load up the subfile.

                  Everything appears to work as expected now.

                  Thanks!

                  Comment

                  Working...
                  X