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.
Dig Deeper on iSeries programming commands
Related Q&A from John Blenkinsop
When an error occurs on an IBM command, the diagnostic messages are sent first, then an escape message, which you can monitor. On AS/400 you see the ...continue reading
Learn how to 'append data to the file' with the FTP DIR command, and eliminate the hassle of having to end the FTP session and restart to view ...continue reading
RPGIV will 'think of' incoming integer fields as binary, and then will redefine them in the program structures as PACKED. So, when you chain a record...continue reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.