ibm-midrangerpg

Display File with interactive operations and an autorefreshing clock


I am curious if it is possible to have a Display File with a clock that updates every second and you still can work on it interactively. Like a menu where you can choose programms and still having a clock on display that autorefreshes. So far I have found this here: https://www.ibm.com/support/pages/program-example-automatically-refreshing-screen-using-opm-rpg400 It is old and you cant have interactions while it refreshes. You have to wait until the loop is done before you can interact. When I put exfmt inside the loop, it refreshes once and not doing anything until there some presses enter obviously.

Any ideas how I could do it? Thanks.


Solution

  • Short answer - no. The block oriented nature of the 5250 protocol doesn't support that.

    Long answer - Maybe, depends on the "interaction" you require.

    That IBM RPG III sample shows the key requirements

    The late, great Booth Martin put together a Kiosk Clock demo that has been archived at midrange.com with the permission of his family.

    enter image description here

    From the comments of the linked source

      // Special notes concerning the auto-refresh feature.  The goal is to *
      // have the screen be auto-refreshing on a user-selected time period. *
      // At the same time, we need the user to be able to interrupt the     *
      // cycle at will.                                                     *
      //   1-The *DSPF must have the INVITE keyword, and if there is to be a*
      //     subfile then INVITE must be conditioned with an indicator.     *
      //     That indicator must be off when clearing and filling the       *
      //     subfile.  Tip: Use a unique indicator.                         *
      //   2-Look at the F-spec.  You need "workstn maxdev(*file)"          *
      //   3-The RPGLE program must use WRITE/READ combinations.            *
      //        --->Do not use EXFMT. <----------------------------- !!!!!  *
      //   4-The conditioning indicator must be on when doing a WRITE/READ. *
      //   5-Remember the rulz: Always WRITE the record and READ the file.  *
      //   6-Use a MONITOR/ON_ERROR/ENDMON block on all WRITE/READ pairs.   *
      //   7- wCmd = 'OVRDSPF FILE(CLOCKD) WAITRCD('                        *
      //         + %char(%int(wMinutes * 60)) + ')';  is what makes it work.*
      //   8-When the screen times out, MUST set off conditioning indicator *
      //     and then WRITE the screen again, so the INVITE keyword         *
      //     is not active.                                                 *
      //   9-KEEP is the keyword to keep the background screen from going   *
      //     black on the second & subsequent writes of the format.         *