Unconfigured Ad Widget



No announcement yet.

Refresh Interactive Screens

  • Filter
  • Time
  • Show
Clear All
new posts

  • Refresh Interactive Screens

    Anyone know of any way to refresh an interactive screen automatically? Example.. user is sitting on a screen thet they monitor all day and can take options to orders. I want this to refresh so it updates the data all the time. Is there any "special" feature that can basically hit a function key or enter key to refresh it? The way i see it is its interactive and is relying on the user to press some key. I want to code around that if I can. Any help would be great.


  • #2
    Hi Ron,

    Here is how I do it.

    In the DDS source
    Add the file level INVITE keyword.

    A DSPSIZ(24 80 *DS3)

    Compile the display file with WAITRCD(x) where x is the number of seconds you want to wait automatically before refreshing the screen.

    In the RPG source
    On the F spec for the display file add the keyword maxdev(*FILE)

    You cannot use EXFMT, so you need to do a WRITE record name followed by a READ(e) file name in your do loop.

    So the code would look something like this with a file called dtaqout that contains a record format named getrec.

    Fdtaqoutd CF E maxdev(*FILE)

    dou *in03 ;
    write getrec;
    read(e) dtaqoutd;




    • #3
      It sitll will not work.. I got it to work with a regular screen but a subfile is where I need it to work.



      • #4

        For quick and dirty, just create a simple macro in i Access for Windows to automatically press the F5 key.


        • #5
          I woudl rather not do that. Not a fan of those kind of solutions. Thanks anyway.


          • #6
            I have an example of using a data queue to automatically refresh a screen without any user intervention. However, it is written in COBOL...but your more than welcome to have a copy of it...



            • #7
              Thanks but my COBOL is really rusty.. I probably could not even read it righ anymore...

              Thanks anyways.


              • #9
                Thanks but I have seen those. I can get a single screen to work but not the subfile. It displays the data in the subfile just fine using the write and read method. I have the invite and all the other goodies in the program (same program that uses the regualr screen). It just will not time out and dispaly it again and again after 3 seconds like it does for the regualr screen. I have complied the screen with a 3 second timeout. There has to be something I'm missing. It does not seem that hard...lol



                • #10
                  For some strange reason that I have never managed to find an explanation for, the method I suggested yesterday does not work with subfile displays. You didn't mention it was a subfile program, otherwise I would have suggested this method instead.

                  The last article cited by SPITCHER http://www.itjungle.com/mpo/mpo081502-story06.html does what you want. It allows input to your program from the screen and from a data queue at the same time. You will need to ammend your subfile program to call the QRCVDTAQ API and add some code to rebuild or update the subfile when data is received from the data queue.

                  I suggest creating a trigger program on the file or files that hold the order data. When the data in these files is changed, have the trigger program write an entry to a data queue. This data queue has been attached to the display file of the subfile program at compile time or using the CHGDSPF command. Then have the subfile program use whatever data sent to the data queue to rebuild or update the subfile without user input.

                  When I used this technique, I sent the order number to the data queue. My program updated the subfile when existing order details had been changed. I rebuilt the subfile if an order had been deleted, completed or new details were added to an existing order.

                  At the site I coded this for, there was only one person doing order entry. If your site has multiple users entering orders at the same time you will need to come up with something a bit more complex than this, but at least it is a start.




                  • #11
                    I don't need to store the data anywhere to start the subfile Its an EDI monitor program. When new EDI orders come in it displays them on the screen for the user. Then they can accept them or reject. So no input at the time it gets generated. The only problem I'm having is it will not time out like a regualt screen does.
                    I created a simple subfile that just counts to 100. Then when it times out it would count to 200 etc.. It does not time out. It does what I want it to do when I hit enter. I did this with a screen to display 1 then add 2.... every 3 seconds and thats works just fine. Its the subfile who is the problem.. I must have missed something but its coded the same.
                    Any ideas?


                    • #12
                      Okay, forget what I said in my last post about not being able to do it with a subfile.

                      I just cobbled this together and it works. No data queues, just a subfile.

                      The display file SELFUPD2 should be created with WAITRCD(3)
                           A                                      DSPSIZ(24 80 *DS3)
                           A                                      PRINT
                           A                                      INVITE
                           A                                      CA03(03 'exit')
                           A          R SFL1                      SFL
                           A            SDATA          5   O  4  4
                           A          R CTL1                      SFLCTL(SFL1)
                           A                                      OVERLAY
                           A  91                                  SFLDSP
                           A  90                                  SFLDSPCTL
                           A  89                                  SFLCLR
                           A                                      SFLSIZ(0161)
                           A                                      SFLPAG(0160)
                           A                                      SFLLIN(0004)
                           A  90                                  SFLEND(*MORE)
                           A                                  1  3TIME
                           A                                  1 30'SELF UPDATING DISPLAY'
                           A                                      DSPATR(HI)
                           A                                      DSPATR(UL)
                           A                                  3 26'Your Data Will Be Shown Here'
                           A                                      DSPATR(HI)
                           A          R FKEYS
                           A                                      OVERLAY
                           A                                 24  4'F3=Exit'
                           A                                      COLOR(BLU)
                      The RPG program SELFUPR2 should be created with DFTACTGRP(*NO)
                           FSELFUPD2  CF   E             WORKSTN SFILE(SFL1:RRN1) maxdev(*file)
                           D event           S              5a
                           D rrn1            S              4  0
                           d subFileFull     c                   999
                             exsr ClrSfl;
                             write fkeys;
                             dou *In03 ;
                                if rrn1 >= subfileFull;
                                   exsr clrSfl;
                                write(e) ctl1;
                                read(e) selfupd2 ; //ĪRead From Display File
                                sData  = %subst(%char(%time):4:5);
                                rrn1 += 1;
                                Write(e)  sfl1;
                                *IN91 = *On  ;
                             enddo ;
                             *inlr = *On ;
                             begsr clrSfl;
                                *In89 = *On ;
                                *In90 = *Off ;
                                *In91 = *Off ;
                                *In75 = *Off ;
                                write(e)  ctl1;
                                rrn1 = 0 ;
                                *In89 = *Off ;
                                *In90 = *On  ;
                                *In91 = *Off ;
                             endsr ;
                      When called the program adds a record to the subfile then displays it. It keeps adding and displaying automatically.
                      The only thing I would say is make sure you read the filename rather than the subfile control record name.


                      • #13
                        So that seem to work. I think the problem was doing the read to the display file name. So I took a gamble and applied the same kind of logic to the actual program ( written years ago) This program has the read and write and all the extra stuff needed including the 3 second wait time. it works to trigger the display file again but get this error... any ideas on what I can look at to fix this...So I thought I would put a monitor around the read subfile file b/c I was getting this error. But it tuens out I get the error again down the line when it tries to chain to the subfile for an update.
                        Any ideas?

                        Message . . . . : SFLDSPCTL or SFLDSP option required for PUTGET.
                        Cause . . . . . : The SFLDSPCTL or SFLDSP option is required for PUTGET for
                        file S#DP546 in library RONTEMP. GET part of PUTGET required that input or
                        output be done. However, input or output cannot be done unless SFLDSPCTL or
                        SFLDSP is specified.
                        Recovery . . . : Either correct the program or the device file and then try


                        • #14
                          This is how I did it back in 2003. Added Invite key word to last record written to screen before the read (I always write a footer record for SFLs). added MAXDEV(*FILE) to program display file definition. Write control record then footer record. Read display file and check for error. If error status is 1331, it was a time out and I just reload the SFL with the refreshed data. We actually had a file with the wait time per user and overrode the display file wait time before opening the file.


                          • #15
                            I could do that but still would get the error I'm getting.. Its such a cobbled up program to begin with.. I wish I had time to re-wright it but I don't.

                            Thanks for your input