Midrange News for the IBM i Community


Posted by: Bob Cozzi
Rogue Programmer
Cozzi Productions, Inc.
Chicagoland
How to do Workstation Timeout in RPG IV
© 2009 Bob Cozzi. All rights reserved. has no ratings.
Published: 11 Feb 2011
Revised: 23 Jan 2013 - 4111 days ago
Last viewed on: 26 Apr 2024 (12317 views) 

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.

How to do Workstation Timeout in RPG IV Published by: Bob Cozzi on 11 Feb 2011 view comments
© 2009 Bob Cozzi. All rights reserved.

How to Enable the "workstation time-out" feature in RPG

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:

  1. In the DSPF DDS source, add the INVITE keyword to the Workstation display file. This is a file-level keyword.
  2. When compiling the DSPF DDS source, specify the WAITRCD parameter on CRTDSPF to set the desired time-out period.
  3. In the RPG source, add the MAXDEV(*FILE) keyword to the File specification for the Workstation device file.
  4. Write the desired display file formats to the display using the WRITE operation code (do not use EXFMT it does not suppor time out).
  5. 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
   

Return to midrangenews.com home page.
Sort Ascend | Descend

COMMENTS