EXAMPLE 2

This example shows multi-level menus generated in a single PM.  The differences between this example and Example 1 are:

  1. The separation of the LAYOUT SCREEN definition into GS;

  2. The execution of a trigger when the DELETE item is selected;

  3. The use of @MENU_KEYWORD instead of @MENU_CHOICE for determining which item has been selected;

  4. Not removing the menus from memory with the FLUSH statement.  These menus can be reused without another GENERATE statement.

1   %menu_id,   INT,MAX
2   !
3   LAYOUT SCREEN %file_update
4   / MENU 5 5 15 60 @NORMAL
5   / SELECTION 1 0 @REVERSE
6   / BORDER   @REVERSE  "Customer Update"
7   /
8   / LINE 13 1 13 60 @NORMAL
9   / MESSAGE 14 20 @NORMAL  "This menu is for Western"
10  / MESSAGE 15 23 @NORMAL  "Region customers only"
11  /
12  / ITEM 3 15 @NORMAL  "Add a new customer record"
13  /   KEYWORD 3 5 @NORMAL  "ADD"
14  /   HELP 18 5 4 60 @NORMAL
15  /     TEXT "This menu selection should be used to add a"
16  /     TEXT "new customer to the Master Customer List"
17  /
18  / ITEM 5 15 @NORMAL  "Change a customer record"
19  /   KEYWORD 5 5 @NORMAL  "CHANGE"
20  /   HELP 18 5 4 60 @NORMAL
21  /     TEXT "This Menu selection should be used to change"
22  /     TEXT "an existing customer record."
23  /
24  / ITEM 7 15 @NORMAL  "Delete a customer record"
25  /   KEYWORD 7 5 @NORMAL  "DELETE"
26  /   PERFORM delete_trigger
27  /   HELP 18 5 4 60 @NORMAL
28  /     TEXT "This Menu Selection should be used to delete"
29  /     TEXT "an existing customer record."
30  /
31  / ITEM 9 15 @NORMAL  "Show a customer record"
32  /   KEYWORD 9 5 @NORMAL  "SHOW"
33  /   HELP 18 5 4 60 @NORMAL
34  /     TEXT "This Menu Selection should be used to view a"
35  /     TEXT "customer record."
36  /
37  / ITEM 11 15 @NORMAL  "Leave customer update"
38  /   KEYWORD 11 5 @NORMAL  "EXIT"
39  /   HELP 18 5 4 60 @NORMAL

40  /     TEXT "This menu selection is used to leave this"
41  / TEXT "menu."
42  LAYOUT END
43  !
44  %delete_id INT  MAX
45  !
46  LAYOUT SCREEN %delete_box
47  /   MENU 16 40 6 30 @NORMAL
48  /   SELECTION 1 3 @REVERSE
49  /   BORDER

50  /
51  /   MESSAGE 2 4 @NORMAL  "Do you really want"
52  /   MESSAGE 3 4 @NORMAL  "to delete customer record?"
53  /
54  / ITEM 5 5 @NORMAL  ""
55  /   KEYWORD 5 5 @NORMAL  "YES"
56  /
57  / ITEM 5 18 @NORMAL  ""
58  /   KEYWORD 5 18 @NORMAL  "NO"
59  LAYOUT END

EXPLANATION OF THE EXAMPLE 2

Example 1    Example 3