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.
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:
....+....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.
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
ENDPGMIf 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, 2006. All Rights Reserved.