Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.
There are five things required to provide a time-out option on any 5250 workstation file. This capability allows an RPG program to receive control before an end-user presses a Function key or Enter. Some of the uses for this kind of function include:
- Providing a marquee for a schedule via a subfile
- Update the time displayed on the workstation at regular intervals
- Refresh the information, such as a news display, periodically
As mentioned, there are five things required to activate workstation time-out:
- In the DSPF DDS source, add the INVITE keyword to the Workstation display file. This is a file-level keyword.
- When compiling the DSPF DDS source, specify the WAITRCD parameter on CRTDSPF to set the desired time-out period.
- In the RPG source, add the MAXDEV(*FILE) keyword to the File specification for the Workstation device file.
- Write the desired display file formats to the display using the WRITE operation code (do not use EXFMT it does not suppor time out).
- Use the READ operation code to read Display File name, not the Record format name.
You must avoid using EXFMT and you must avoid reading the record format name as these items do not support workstation time-out.
See lines 1 and 10 in the example below. Note the MAXDEV(*FILE) on line 1, and the READ to the WORKSTN file. These are the key components to make this work correctly.
. FMarquee CF E WORKSTN MAXDEV(*FILE) F SFILE(detail:rrn) C Write Header C Write Footer C Do 12 rrn C Write Detail C enddo C Write SFLCTLFMT C Read Marqueer