Automatic refresh of display screen

I need to have a screen refresh the data after being displayed for 30 seconds on the screen. I am displaying a subfile and need the ability to page up and down. I have tried several options, such as building the subfile, writing the control record, waiting for 30 seconds then reading the control record. The problem occurs, after reading the control record, the progam will wait for a key to be pressed on the screen which defeats the purpose of the automatic refresh. How do I maintain the ability to page up and down and have the screen automatically refresh after a selected period of time? The program is RPGILE.

Answer Wiki

Thanks. We'll let you know when a new response is added.


There is a facility to link the display of data on a display to a data queue. The system will then notify you through the data queue if data was received from the display device. Have a look at the OVRDSPF command where you specify the data queue name. Your main display program will wait for an entry from the data queue before performing any displays, etc.

Then you write another program that will run at the same time as your display program that will perform the timing for the refresh by posting an entry into that data queue every 30 seconds. Your main program will receive this entry through the data queue and perform a refresh.

The nice thing about this is that you have only one data queue that will drive both events:
1. An entry from the display
2. The 30 second heartbeat

There is however a catch. The data you send to a display device is only physically displayed at the next read (from the dislay). This means that the refreshed data will be a display behind. But there is a solution. Have a look at deferred or no-deferred write when you compile the program. You have to select no-deferred write. This will then force the display of the refreshed data at the time you write to the display. I have used this option before but can’t exactly remember where to specify this. Please do some searching.

What is also nice is that you can now refine the two programs – display and timer – to interact so that when a user enters data from the display the timer is reset to 30 second otherwise you can have a refresh shortly after data was entered.

Good luck.



First, the question is incomplete. What does “the ability to page up and down” have to do with “automatically refresh after a selected period of time“?

It seems like those two elements should not be combined in a single function. If both are available, sooner or later they’re both going to happen at the same time. (In fact, it would seem a regular possibility.) Will the keyboard be buffered? Take care in how you handle active keyboards concurrently with active output.

See Auto refresh screen – Data queue style for one useful example.


Discuss This Question: 1  Reply

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • Martin40
    Hi, In the display file DDS code an INVITE on the record header ands condition it with an indicator. In the RPG code MAXDEV(*FILE) INFDS(IODATA) for the workstation file. e.g. FMSM640DF CF E WORKSTN F MAXDEV(*FILE) F INFDS(IODATA) Code the IODATA data structure e.g. D IODATA DS D STATUS *STATUS Change the EXFMT's to be WRITE/READS. Before the WRITE seton the indicator that was used to condition the INVITE. After the READ check the condition of STATUS e.g. Note 58 in
    0 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: