Another way to run an ILE COBOL program is from a menu-driven application. The workstation user selects an option from a menu, calling the appropriate program. The following figure illustrates an example of an application menu.
Figure 30. Example of an Application Menu
+--------------------------------------------------------------------------------+ | PAYROLL DEPARTMENT MENU | | | | 1. Inquire into employee master | | 2. Change employee master | | 3. Add new employee | | 4. Return | | | | | | Option: | | | +--------------------------------------------------------------------------------+
The menu shown in this figure is normally displayed by a CL program in which each option calls a separate COBOL program.
The DDS for the display file of the above PAYROLL DEPARTMENT MENU looks like the following:
Figure 31. Data Description Specification of an Application Menu
....+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 A* MENU PAYROLLD PAYROLL DEPARTMENT MENU A A R MENU TEXT('PAYROLL DEPARTMENT MENU') A 1 29'PAYROLL DEPARTMENT MENU' A 5 4'1. Inquire into employee master' A 6 4'2. Change employee master' A 7 4'3. Add new employee' A 8 4'4. Return' A 12 2'Option:' A RESP 12 10VALUES(1 2 3 4) A DSPATR(MDT) |
Figure 31 shows an example of the CL program for the application menu illustrated in Figure 30.
Figure 32. Example of a CL program which calls ILE COBOL Programs
PGM /* PAYROLL Payroll Department Menu */ DCLF FILE (PAYROLLD) START: SNDRCVF RCDFMT(MENU) IF (&RESP=1); THEN(CALL CBLINQ) /* Inquiry */ ELSE + IF (&RESP=2); THEN(CALL CBLCHG) /* Change */ ELSE + IF (&RESP=3); THEN(CALL CBLADD) /* Add */ ELSE + IF (&RESP=4); THEN(RETURN) /* Return */ GOTO START ENDPGM |
If the user enters 1, 2, or 3 from the application menu, the CL program in Figure 32 calls the ILE COBOL programs CBLINQ, CBLCHG, or CBLADD respectively. If the user enters 4 from the application menu, the CL program returns to the program that called it.
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.