Lesson 7: A Pop-up Menu Program

Programs of some complexity usually require the user to select optional actions. Often such selection is by menus or function keys. Menus make the available options clear to the user, while function keys are sometimes provided as shortcut keys for experienced users.

In this lesson we create a pop-up menu procedure giving options to run the customer number and customer name enquiry programs created in lessons 5 and 6.

So far you’ve written programs containing interactive and batch procedures. Another procedure type is menu. With a menu procedure the user selects an option and the procedure tree is constructed so that the branch which is executed depends on that option.

Your program will combine the customer number and customer name enquiries on a menu like this:

The procedure tree is specified as follows:

In the procedure tree, the CUSTOMER_ENQ menu procedure is marked with an M, which indicates that it is a menu procedure. When option 1 is chosen, C_NO_ENQUIRY is executed; when option 2 is chosen, C_NAME_ENQUIRY is executed.

·   Creating a Menu

·   Adding the Subsidiary Procedures