IBM Support

ILE RPG IV Example Program of using Windows in Separate Display Files while Setting on LR

Troubleshooting


Problem

This is an example of an ILE RPG IV program that calls another ILE RPG IV program to put up a window.
The second ILE RPG IV program then calls a third program to put up another window.

Resolving The Problem

This is an example of an RPG program that calls another ILE RPG IV program to put up a window. The second ILE RPG IV program then calls a third program to put up another window. In this example, all of the RPG programs are setting on LR. If you are not setting on LR in the window program, see the example that demonstrates this technique.

Both Display File 2 and Display File 3 must be compiled with RSTDSP(*YES).

Display File 1 - WINDOW1:
     A                                      DSPSIZ(24 80 *DS3)
     A                                      HELP
     A                                      CA03(03)
     A                                      ALTHELP(CA01)
     A* = = =
     A          R FMT1
     A                                 10  3'FULL SCREEN'
     A                                 11  3'THE WINDOW WILL DISPLAY           -
     A                                        '
     A                                 12  3'ON TOP OF THIS DISPLAY.'
     A            FLD1          12A  B 13  3
     A* = = =
     A          R FMT2
     A                                 23  3'F3=EXIT'
     A                                      COLOR(BLU)
     A* = = =
     A          R WIND                      WINDOW(4 5 10 10 *NOMSGLIN)
     A            FLD2           5   O  2  3
     A* = = =
     A          R DUMMY                     ASSUME
     A                                      OVERLAY
     A                                  2  3' ' 

RPG Program WINDOW1:
**FREE
 Dcl-F WINDOW1    WORKSTN;
 // Prototype for WDW2
 Dcl-Pr Pgm_WDW2 ExtPgm('WDW2') End-Pr;
 DoW *IN03 = '0';
    Exfmt FMT1;
    If *IN03 = '0';
       Pgm_WDW2();
    EndIf;
 EndDo;
 *INLR = '1'; 


Display File 2 - WNDOW2:
     A                                      DSPSIZ(24 80 *DS3)
     A                                      HELP
     A                                      CA03(03)
     A                                      ALTHELP(CA01)
     A          R WIND                      WINDOW(4 5 10 10 *NOMSGLIN)
     A            FLD2           5   B  2  3
     A*
     A          R DUMMY                     ASSUME
     A                                  2  3' '     


RPG Program 2 WDW2A:
**FREE
 Dcl-F WNDOW2     WORKSTN;
 // Prototype for WDW3
 Dcl-Pr Pgm_WDW3A ExtPgm('WDW3A') End-Pr;
 DoW *IN03 = '0';
    Exfmt WIND;
    If *IN03 = '0';
       Pgm_WDW3A();
    EndIf;
 EndDo;
 *INLR = '1';    

Display File 3 - WNDOW3:
     A                                      DSPSIZ(24 80 *DS3)
     A                                      HELP
     A                                      CA03(03)
     A          R WIND                      WINDOW(8 9 10 10 *NOMSGLIN)
     A            FLD2           5   B  2  3
     A*
     A          R DUMMY                     ASSUME
     A                                      OVERLAY
     A                                  2  3' '      

RPG Program 3 - WDW3A:
**FREE
 Dcl-F WNDOW3     WORKSTN;
 DoW *IN03 = '0';
    Exfmt WIND;
    If *IN03 = '0';
    EndIf;
 EndDo;
 *INLR = '1';       
Compile ILE RPG IV program using CRTBNDRPG
Call from command line:
 Type command, press Enter.
 ===> call wdw1a           

 
Interact with the display files using ENTER and F3 key.
 
image-20241127134317-1
image-20241127134337-2
image-20241127134358-3

[{"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

7954410

Document Information

Modified date:
27 November 2024

UID

nas8N1010262