• Re: Advanced refresh of AS/400 screens

    From Vickey Clemmons@21:1/5 to Robin Tatam on Wed Oct 12 13:22:55 2022
    On Friday, February 28, 1997 at 2:00:00 AM UTC-6, Robin Tatam wrote:
    The most flexible and functional way - better than expiring the DSPF record
    - is to add a data queue to the display file -

    Create a data queue - CRTDTAQ - with a length of 80 as below and attach
    that data queue to the display file (you can do this when creating -
    CRTDSPF - or when changing - CHGDSPF - and you may even be able to do with
    an override - OVRDSPF) /*-------------------------------------------------------------------*/
    /* Create the screen file data queue used for auto refresh and */
    /* attach */ /*-------------------------------------------------------------------*/ DLTDTAQ DTAQ(QTEMP/WAV001Q)
    MONMSG MSGID(CPF2105)
    CRTDTAQ DTAQ(QTEMP/WAV001Q) MAXLEN(80) SEQ(*LIFO) +
    TEXT('Wave System - Wave List Auto +
    Refresh Data Queue')
    OVRDSPF FILE(WAV001D) DTAQ(QTEMP/WAV001Q)

    In your RPG, perform a WRITE to the screen (*NOT* an EXFMT) as below
    C*
    C* Write the Subfile list to display it
    C*
    C WRITESFLCTL
    C*
    C* Set up the data queue parameters
    C*
    C MOVEL'WAV001Q' @@DQNM Name of the data
    queue
    C MOVEL'QTEMP' @@DQLB Library that the
    data queue is in
    C Z-ADD80 @@DQLN Length of the
    data queue format
    C MOVE *BLANKS @@DQDT Data field to
    capture user input
    C Z-ADD@@TIME @@DQWT Wait for input
    or until time limit (time of -1 means forever)
    C*
    C* Wait to see if the user presses a key (retrieved by Data Queue)
    C*
    C CALL 'QRCVDTAQ' 91
    C PARM @@DQNM
    C PARM @@DQLB
    C PARM @@DQLN
    C PARM @@DQDT
    C PARM @@DQWT
    C*
    C* If the data queue entry is blank then this was a screen timeout
    C* so just rebuild the subfile and redisplay
    C*
    C @@DQDT IFEQ *BLANKS
    C EXSR SR002
    C ITER
    C END
    C*
    C* Read the Subfile list for the user entry
    C*
    C READ SFLCTL 01

    The big advantage to this is that using a varaible you can vary the length
    of time you wait to refresh - the above code was taken from an application that was a subfile screen that lets the user set the refresh interval !!!
    You also avoid those annoying errors caused by the display expiring at the same time as the user pressing the key !!
    I can't remember if the display file needs to set up as a Defer Write - DFRWRT(*NO) - and the CL program I took this from doesn't do an override to do that - but if you run this and it doesn't work then either add
    DFRWRT(*NO) to the OVRDSPF command or compile your display file with DFRWRT(*NO) specified

    Let me know if I can help any more - I've done lots of these
    Robin Tatam
    rta...@acsltd.com
    http://www.acsltd.com
    Joey Myers <jmy...@popalex1.linknet.net> wrote in article <0997012609463...@popalex1.linknet.net>...
    On Wed, 19 Feb 1997 22:35:33 GMT, kou...@iaehv.nl (Ron Koudijs)
    wrote:

    I have been asked to bild an application on our AS/400 (V3R7) with a >screen that will automaticly refresh it self without the user having
    the press a functionkey (like F5) or something.

    Does anybody know how ... ?

    In RPG instead of using a EXCPT to display a screen and wait for an
    input, use a WRITE followed by a READ with indicators on the error indication field (LO) and the end-of-file indication field (EQ) of the
    READ so the program won't blow up if one of these errors occurs. You
    don't actually have to do anything with these error indicators. When
    you compile the display file prompt for additional parameters and enter
    a value for the WAITRCD parameter to indicate the number of seconds you want to wait before continuing on after a write to the display file.
    Now, just loop your program through your screen update routine and
    return to your WRITE/READ combination. Allow the user to enter a
    function key to exit the program and monitor for the key in the update loop.

    Below is a simple version of what to do:

    C *IN,03 DOWNE*ON
    C WRITESFCTRL
    C READ DSPFIL 5050
    C EXSR UPDATE
    C ENDDO



    I am get and RNQ1021 error (Attempt to write a duplicate record on display file) - any pointers?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)