15. Embedded Forms Program Structure : The Display Block : Nested Menus
 
Share this page                  
Nested Menus
A nested menu is invoked by the display submenu statement.
This statement has the following syntax:
display submenu;
Nested menus differ from simple submenus in the following ways:
You can define field activations (in addition to menu items and FRS keys) in nested menus. Field activations in the outer display loop (or nested menu) are not inherited.
Running from a nested menu is exactly like running from a display loop; this includes using the resume statement. Unlike submenus, nested menus allow the user to move the cursor around the screen the same way as in a display loop.
Multiple levels of nesting are allowed.
To terminate a nested menu, you must use either the breakdisplay or enddisplay statement. The behavior of these statements are the same as in a normal display loop. Breakdisplay simply terminates the nested menu while enddisplay first validates all fields before exiting. Once a nested menu exits, the enclosing display loop (or nested menu) is restored.
The following embedded SQL example shows how you can use display submenu to create a nested menu:
...
exec frs activate menuitem 'EmpOps';
exec frs begin;
     exec frs display submenu;
     exec frs activate menuitem 'UpdateAge';
     exec frs begin;
          Do processing to update employee's age;
          exec frs breakdisplay;
     exec frs end;
     exec frs activate menuitem 'UpdateSal';
     exec frs begin;
          Do processing to update employee's salary;
          exec frs breakdisplay;
     exec frs end;
     exec frs activate menuitem 'End';
     exec frs begin;
          exec frs breakdisplay;
     exec frs end;
exec frs end;