Here's some old RPG III / IV i found that should work for this.
* Screen file...
farockd cf e workstn
f maxdev(*file) for screen timeout
c write screen1
c read arockd 9899
* This code performs auto screen/time refresh...
c if *in98 = *on
c exsr @exit
You can set the system value QINACTITV