//****************************************************************
// PROGRAM NAME: CUSMAIN *
// RELATED FILES: MAINMENU (DSPF) *
// RELATED PGMS: CUSMNT (ILE RPG PGM) *
// SCHZIP (ILE RPG PGM) *
// SCHNAM (ILE RPG PGM) *
// DESCRIPTION: This is a customer main inquiry program. *
// It prompts the user to choose from one of the *
// following actions: *
// 1.Maintain (add, update, delete and display) *
// customer records. *
// 2.Search customer record by zip code. *
// 3.Search customer record by name. *
//****************************************************************
Fmainmenu cf e workstn indds(indicators)
// Prototype definitions:
D CustMaintain pr extproc('CUSMNT')
D SearchZip pr extproc('SCHZIP')
D SearchName pr extproc('SCHNAM')
// Field definitions:
D indicators ds
D exitKey n overlay(indicators:3)
D maintainKey n overlay(indicators:5)
D srchZipKey n overlay(indicators:6)
D srchCustKey n overlay(indicators:7)
/free
// Keep looping until exit key is pressed
dow '1';
// Display main menu
exfmt hdrscn;
// Perform requested action
if exitKey;
// Exit program
leave;
elseif maintainKey;
// Maintain customer data
CustMaintain();
elseif srchZipKey;
// Search customer data on ZIP code
SearchZip();
elseif srchCustKey;
// Search customer data on customer name
SearchName();
endif;
enddo;
*inlr = *on;
/end-free
This module illustrates the use of the CALLB opcode. The appropriate RPG module (CUSMNT, SCHZIP, or SCHNAM) is called by CUSMAIN depending on the user's menu item selection.
To create the program object:
CRTPGM PGM(MYPROG) MODULE(CUSMAIN CUSMNT SCHZIP SCHNAM) ENTMOD(*FIRST)
CALL MYPROG
The "main menu" will appear as in Figure 199.
22:30:05 CUSTOMER MAIN INQUIRY 9/30/94 Press one of the following PF keys. F3 End Job F5 Maintain Customer File F6 Search Customer by Zip Code F7 Search Customer by Name