Ask the Expert

iSeries application display subfiles with other program windows

I have 3 programs, ProgA, ProgB and ProgC. ProgB is a subfile and ProgC is a window with a single record. From ProgA, I want to call ProgB to display the subfile but then also call ProgC so the window displays. I don't want the user to be stopped in ProgB and have to press a key to call ProgC. When I changed the Exfmt in ProgB to a "write", the subfile does not display. Though I do get the window record.

I get the same thing when I test this -- my 'program B' subfile does not appear, but the window in my 'program C' does. This is because the display file for ProgB is created with the option DFRWRT(*YES). Changing the display file to DFRWRT(*NO) makes the programs behave exactly the way you want them to.

DFRWRT(*YES) tells the workstation controller to 'Defer writing the display formats until you receive a READ'. So, your program sends display formats using WRITE, and the workstation controller just stores them all -- it does not send the display formats to the screen device until your program sends either a READ operation or an EXFMT.

When your ProgB calls ProgC, ProgC uses EXFMT to write-then-read its own format. The workstation controller sends this format to the screen, leapfrogging the stored formats from ProgB. When ProgC ends, and control returns to ProgB, ProgB does a READ and the workstation controller then sends the formats and waits for user input to return to ProgB.

So, change the display file for ProgB to DFRWRT(*NO). You should ONLY do this in situations like this - usually, DFRWRT(*NO) is a bad option to use, since it can cause screen flashing and other strange effects.

This was first published in April 2008

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: