ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Auto Refresh Subfile Screen

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

  • Auto Refresh Subfile Screen

    I have a subfile screen which is control by RPG. Because the information in subfile will be changing from time to time, so i wish it to be refresh every 10 seconds in order to dsiplay the latest information on screen. Can i make this process automatically without need to press any function key?

    Thanks in advance.

  • #2
    Re: Auto Refresh Subfile Screen

    Yes you can. I can think of several ways.

    Take a look at the monitor job here http://www.rpgiv.org/monitor.htm

    It's not exactly what you want but it is close

    Comment


    • #3
      Re: Auto Refresh Subfile Screen

      Originally posted by keanhoo168
      I have a subfile screen which is control by RPG. Because the information in subfile will be changing from time to time, so i wish it to be refresh every 10 seconds in order to dsiplay the latest information on screen. Can i make this process automatically without need to press any function key?

      Thanks in advance.
      One fairly simple approach is to create the display file with WAITRCD(10). IIRC, this will return control to your program after 10 seconds of no user activity. You can then update the contents of your subfile.

      Jonas
      Jonas Temple
      Got FROG?
      Got Tadpole? No, because it's not done yet! Stay tuned....

      01010111 01100001 01110011 01110011 01110101 01110000 00100000 01100100 01101111 01100111 00111111

      Comment


      • #4
        Re: Auto Refresh Subfile Screen

        I have try the WAITRCD method, but it seems doesn't work, my subfile does not refresh by itself. The monitor method also does not look like can solve my problem.

        I think i should explain my situation more detail. Actually, my subfile information is come from a physical file(PF). The RPG will loop thru the PF and display the data on screen. When user select one of the line, the DSPF will move to another record screen and so on until the end. Then it will come back to the first screen which is the subfile screen i mentioned earlier.

        What i intend to do is when user is in the first screen (subfile screen), if the user does not do any action for a period of time, the subfile will be able to refresh itself with the latest inforamtion in the PF.

        Hope someone can guide me thru this. If possible, please provide some sample code for me. I would appreciate your help very very much.
        Attached Files

        Comment


        • #5
          Re: Auto Refresh Subfile Screen

          Originally posted by keanhoo168
          I think i should explain my situation more detail. Actually, my subfile information is come from a physical file(PF). The RPG will loop thru the PF and display the data on screen. When user select one of the line, the DSPF will move to another record screen and so on until the end. Then it will come back to the first screen which is the subfile screen i mentioned earlier.

          .

          correct, subfile info does come from physical file...

          but when the subfile records are displayed on the screen, they arent coming from the physical file...they come from the subfile you had built inside your program(one-shot or page subfile, depends on what you have chosen to build it)

          so what you need to look at is to refresh the subfile in your program until a certain action is taken by the useR(select a subfile record to go to the next screen or exit [f1] the screen)..

          i would think about putting this inside a do loop... something that goes like this..

          Dou *in01 = *On or (a record is selected)
          exsr sflbuild
          if *In01 = *On or (a sfl record is selected)
          (go to the routine that does the exit or record selction)
          leave
          else
          iter
          endif
          enddo

          (sflbuild would be the routine that builds/refreshes the subfile before it is displayed)

          goodluck...

          Comment


          • #6
            Re: Auto Refresh Subfile Screen

            Originally posted by keanhoo168
            I have try the WAITRCD method, but it seems doesn't work, my subfile does not refresh by itself. The monitor method also does not look like can solve my problem.

            I think i should explain my situation more detail. Actually, my subfile information is come from a physical file(PF). The RPG will loop thru the PF and display the data on screen. When user select one of the line, the DSPF will move to another record screen and so on until the end. Then it will come back to the first screen which is the subfile screen i mentioned earlier.

            What i intend to do is when user is in the first screen (subfile screen), if the user does not do any action for a period of time, the subfile will be able to refresh itself with the latest inforamtion in the PF.

            Hope someone can guide me thru this. If possible, please provide some sample code for me. I would appreciate your help very very much.
            Then I still think WAITRCD is what you want. The "refresh" will come from your program rebuilding the subfile when the program gets control. The system will not automatically refresh the data for you...if that's what you're thinking.
            Jonas Temple
            Got FROG?
            Got Tadpole? No, because it's not done yet! Stay tuned....

            01010111 01100001 01110011 01110011 01110101 01110000 00100000 01100100 01101111 01100111 00111111

            Comment


            • #7
              Re: Auto Refresh Subfile Screen

              ideally, when a user does any action on the screen(presses, enter, selects a record or exits the screen with a function key), the program hits the EXFMT <rec fmt name> (which is a read followed by a write rec format-and lets the program take control and perform the appropriate action.) otherwise the screen remains still..

              in the do loop mentioned above , sflbuild is a routine that has the EXFMT rec format name . so when the program loops to the build routine even if a user doesnt take any action, we are wiring it to still refresh the screen when it hits the EXFMT statement in the build routine. (hitting the EXMFT again would be like someone pressed enter on the screen and ask the program to take control and do the next step).

              i have had to do this in the past, seen it work...hopefully it works for you too

              havent tried WAITRCD before, but i think that would be cool to kinda give it a try...

              Comment


              • #8
                Re: Auto Refresh Subfile Screen

                SG FTL, i think i get the point of the example u showed. But if user does not pressed any key, the program still cannot gets the control to rebuild the subfile. Then surely the user can't even select a record which does not shown in the subfile but actually it is in the PF. They can do that only if they press a key. Then, there is no point i'm trying to automate the refreshing process using timing since user have to refresh it maually with F5 key prepared. ( like what jtemple said).

                Or maybe actually i didn't get your point ??? Sorry for troublesome you all again.

                Comment


                • #9
                  Re: Auto Refresh Subfile Screen

                  Hello,

                  The code found below will display a screen stating 'initializing, please wait.' until the F3 or F12 key is pressed or a submitted job trips a flag in a data-area.

                  Also, make sure you use the INVITE keyword in the DDS.

                  SLABADIE

                  Comment


                  • #10
                    Re: Auto Refresh Subfile Screen

                    keanhoo...post the subfile code u have at the moment..and we 'll see if we can take it from there..thanks

                    Comment


                    • #11
                      Re: Auto Refresh Subfile Screen

                      Attached is the example I previously mentioned.
                      Attached Files

                      Comment


                      • #12
                        Re: Auto Refresh Subfile Screen

                        This has worked for me

                        1. When you compile your workstation file change the following
                        Maximum record wait time . . . . WAITRCD *NOMAX to the proper wait duration I beleive you stated 10 seconds

                        2. Insert the following into the rpg code

                        Code:
                        FYOURDISPLY  CF   E             WORKSTN              
                        F                                     [COLOR="Red"]INFDS(INFWS) [/COLOR]
                        
                        
                        D INFWS           DS                  
                        D  STAT                  11     15  0
                        
                        
                        C    NEXTWRITE   TAG
                        change          exfmt yourfmt
                        to 
                        C                    WRITE yourfmt
                        and
                        C                    read    yourdisply                                        84
                        add the following
                        C     *IN84         IFEQ      *ON               
                        C     STAT          ANDEQ     1331              
                                                 reload  subfile
                        C                       goto     next write
                        C                        endif
                        Best Wishes
                        GLS
                        The problem with quotes on the internet is that it is hard to verify their authenticity.....Abraham Lincoln

                        Comment


                        • #13
                          Re: Auto Refresh Subfile Screen

                          84 on the read statement is what? Lo or Eq? (error/eof).

                          Bill
                          Bill
                          "A good friend will bail you out of jail,
                          A true friend would be sitting beside you saying,
                          'Wow, that was fun.'"

                          Comment


                          • #14
                            Re: Auto Refresh Subfile Screen

                            Hi Bill:

                            Sorry I should have noted that.

                            It is on low.

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

                            Comment


                            • #15
                              Re: Auto Refresh Subfile Screen

                              For anyone interested file status codes may be found here:

                              http://publib.boulder.ibm.com/cgi-bi...325191514&CASE=

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

                              Comment

                              Working...
                              X