Troubleshooting
Problem
This document contains solutions to common problems when working with Windows in a display file.
Resolving The Problem
Problem:
When I display the window the second time, the old background appears. This is because the window is still active. The usual scenario is as follows:
PGM1 puts up a format and the user can take an option which then calls PGM2. PGM2 puts up a window. Control passes back to PGM1. PGM1 now puts up a different format, and the user again takes an option which ends in a call to PGM2. The new window with the old background appears.
Solution:
Have PGM2 close the display file it uses before returning to PGM1. This can be done by setting on LR if this is an RPG program. This works regardless of the DFTWRT or RSTDSP attribute values.
Have a dummy record format in the window display file. This should have overlay specified. Write this format just before returning to PGM1. DFTWRT *YES is valid; however, RSTDSP must be *NO. This method does not require that the display file be closed when exiting PGM2. (The attributes of the first display file are irrelevant.)
Note: This does not work if the INVITE keyword is specified in the display file for PGM2.
Problem:
When I display the window, I have a blank background. The typical scenario is as follows:
PGM1 puts up a format, and the user takes an option that results in a call to PGM2. PGM2 puts up a window; however, the background is blank.
Solution:
The DDS for the display file in PGM2 (the one that has the window format) does not have the assume keyword specified in it. Add another format to this display file (a dummy record format) that has the keep and assume keywords. You do not have to write this format to the screen for this to work.
Problem:
A different scenario exhibiting the same systems is when PGM1 displays a subfile, and the user takes an option for more than one subfile record (for example, display information for customer 1 and 2). PGM1 then makes a call to PGM2 which puts up a window for Customer 1. Control passes back to PGM1, which gets the next changed record from the subfile (in RPG, this would be done with the READC OPCODE) and calls PGM2 to put up the window with the information for Customer 2. However, this time the background is blank.
Solution:
Do not close the display file (the one containing the window format) when exiting PGM2 (in RPG, this means do not SETON LR).
If you must close the display file in PGM2, when you return to PGM1, you can do another write-to-format before calling PGM2 again. This can be a write to a dummy format. The RSTDSP attribute for the display file in PGM1 must be *YES.
When I display the window the second time, the old background appears. This is because the window is still active. The usual scenario is as follows:
PGM1 puts up a format and the user can take an option which then calls PGM2. PGM2 puts up a window. Control passes back to PGM1. PGM1 now puts up a different format, and the user again takes an option which ends in a call to PGM2. The new window with the old background appears.
Solution:
Have PGM2 close the display file it uses before returning to PGM1. This can be done by setting on LR if this is an RPG program. This works regardless of the DFTWRT or RSTDSP attribute values.
Have a dummy record format in the window display file. This should have overlay specified. Write this format just before returning to PGM1. DFTWRT *YES is valid; however, RSTDSP must be *NO. This method does not require that the display file be closed when exiting PGM2. (The attributes of the first display file are irrelevant.)
Note: This does not work if the INVITE keyword is specified in the display file for PGM2.
Problem:
When I display the window, I have a blank background. The typical scenario is as follows:
PGM1 puts up a format, and the user takes an option that results in a call to PGM2. PGM2 puts up a window; however, the background is blank.
Solution:
The DDS for the display file in PGM2 (the one that has the window format) does not have the assume keyword specified in it. Add another format to this display file (a dummy record format) that has the keep and assume keywords. You do not have to write this format to the screen for this to work.
Problem:
A different scenario exhibiting the same systems is when PGM1 displays a subfile, and the user takes an option for more than one subfile record (for example, display information for customer 1 and 2). PGM1 then makes a call to PGM2 which puts up a window for Customer 1. Control passes back to PGM1, which gets the next changed record from the subfile (in RPG, this would be done with the READC OPCODE) and calls PGM2 to put up the window with the information for Customer 2. However, this time the background is blank.
Solution:
Do not close the display file (the one containing the window format) when exiting PGM2 (in RPG, this means do not SETON LR).
If you must close the display file in PGM2, when you return to PGM1, you can do another write-to-format before calling PGM2 again. This can be a write to a dummy format. The RSTDSP attribute for the display file in PGM1 must be *YES.
[{"Type":"MASTER","Line of Business":{"code":"LOB68","label":"Power HW"},"Business Unit":{"code":"BU070","label":"IBM Infrastructure"},"Product":{"code":"SWG60","label":"IBM i"},"ARM Category":[{"code":"a8m0z0000000CHtAAM","label":"Programming ILE Languages"}],"ARM Case Number":"","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"All Versions"}]
Historical Number
19381828
Was this topic helpful?
Document Information
Modified date:
11 December 2024
UID
nas8N1017793