Running a Program From a Menu-Driven Application

Another way to run an ILE program is from a menu-driven application. The workstation user selects an option from a menu, which in turn calls a particular program. Figure 1 illustrates an example of an application menu.

Figure 1. Example of an Application Menu
                                 PAYROLL DEPARTMENT MENU
 Select one of the following:
      1.  Inquire into employee master
      2.  Change employee master
      3.  Add new employee









 Selection or command
 ===> _________________________________________________________________________
_______________________________________________________________________________
 F3=Exit   F4=Prompt   F9=Retrieve   F12=Cancel
 F13=Information Assistant  F16=AS/400 main menu
 

The menu shown in Figure 1 is displayed by a menu program in which each option calls a separate ILE program. You can create the menu by using STRSDA and selecting option 2 ('Design menus').

Figure 2 shows the DDS for the display file of the above PAYROLL DEPARTMENT MENU. The source member is called PAYROL and has a source type of MNUDDS. The file was created using SDA.

Figure 2. Data Description Specification of an Application Menu
     A* Free Form Menu: PAYROL
     A*
     A                                      DSPSIZ(24 80 *DS3                  -
     A                                             27 132 *DS4)
     A                                      CHGINPDFT
     A                                      INDARA
     A                                      PRINT(*LIBL/QSYSPRT)
     A          R PAYROL
     A                                      DSPMOD(*DS3)
     A                                      LOCK
     A                                      SLNO(01)
     A                                      CLRL(*ALL)
     A                                      ALWROL
     A                                      CF03
     A                                      HELP
     A                                      HOME
     A                                      HLPRTN
     A                                  1 34'PAYROLL DEPARTMENT MENU'
     A                                      DSPATR(HI)
     A                                  3  2'Select one of the following:'
     A                                      COLOR(BLU)
     A                                  5  7'1.'
     A                                  6  7'2.'
     A                                  7  7'3.'
     A* CMDPROMPT  Do not delete this DDS spec.
     A                                019  2'Selection or command              -
     A                                          '
     A                                  5 11'Inquire'
     A                                  5 19'into'
     A                                  5 24'employee'
     A                                  5 33'master'
     A                                  6 11'Change'
     A                                  6 18'employee'
     A                                  6 27'master'
     A                                  7 11'Add'
     A                                  7 15'new'
     A                                  7 19'employee'

Figure 3 shows the source of the application menu illustrated in Figure 1. The source member is called PAYROLQQ and has a source type of MNUCMD. It was also created using SDA.

Figure 3. Source for Menu Program
PAYROLQQ,1
0001 call RPGINQ
0002 call RPGCHG
0003 call RPGADD
You run the menu by entering:
GO library name/PAYROL

If the user enters 1, 2, or 3 from the application menu, the source in Figure 3 calls the programs RPGINQ, RPGCHG, or RPGADD respectively.


Feedback