Search code examples
ibm-midrangerpgle

Multiple display file handling


I have a subfile program that displays records in the below format:

Subfile initial display

There are two options that can be taken on the records ( 5 or 7). Option 5 checks for record existence in a table and if no records are found, the below screen is displayed with a window display file indicating that records were not found:

Display with information window

the issue here is that when a combination of options are taken on the records, for example, if option 5 is taken on one record followed by option 7 on the next and then option 5 again on the next record, the display seems to get distorted.

Option 7 calls a program which displays another display file and when the control comes back to the initial display it appears like this:

Distorted display

How can I display this correctly (with the window appearing with a proper background?) I know that correct usage of keywords like KEEP or ASSUME will do this but not sure how to use this in which display file or on what record formats.


Solution

  • When you are creating the display file, it should be created with keyword RSTDSP(*YES). When a second display file is opened, the display file on the screen is suspended. By default, the first display file is not re-displayed when the second display file is closed. That is when you get wacky screens like the one you showed.

    From the knowledge center

    Restore display (RSTDSP)
    Specifies whether data being shown at a display device by this display file is saved at the time the file is suspended (made temporarily inactive) so that another display file can show different data on the same device. If the data for this file is saved, it is restored to the display of the device when the file is used again.


    *NO The data being shown by this file is not saved when the file is suspended.
    *YES The data being shown when this file is suspended is saved, and it is restored to the device display when the file is used again.