1 &command_line on
  2 &if [equal &n 0] &then &goto explain_this_exec_com
  3 &if [and [equal &n 2] [equal &1 "DuMmY_ArG"]] &then &goto invoke_mrpg
  4 &print run_mrpg_examples.ec:  Argument error.
  5 &print ^23xNo arguments should be supplied when this exec_com is initially invoked.
  6 &print ^23xNeed to supply a number when asked to enter example number.
  7 &quit
  8 
  9 
 10 &label explain_this_exec_com
 11 &print ^2/A menu of available examples will be displayed.
 12 &print Typing in the number of one of the examples causes this exec_com to:
 13 &print ^5xA.   Extract the selected example from an archive,
 14 &print ^5xB.   Invoke MRPG for that example,
 15 &print ^5xC.   In most cases, execute the example.
 16 &print Information about any report segments produced will be displayed.
 17 &print You may then select another example, if you wish.
 18 
 19 
 20 &label display_menu
 21 &print MENU:^/
 22 &print No.  Example
 23 &print ---  ------------------
 24 &print
 25 &print 1    filing_cabinet
 26 &print 2    two_reports
 27 &print 3    hold_and_sort
 28 &print 4    begin_hold_assign
 29 &print 5    negative_parameter
 30 
 31 
 32 &label select_example
 33 &detach
 34 &command_line off
 35 exec_com &ec_name DuMmY_ArG [response [format_line "^/Enter the number of the example you want to run.^/"]]
 36 &command_line on
 37 
 38 &  Control returns here when the second-level invocation of this exec_com ends.
 39 
 40 &if [query [format_line "^2/Do you want to run another example?^/"]]
 41 &then &else &quit
 42 &if [query [format_line "Do you remember its number?  (Type  no  to see the menu again.)^/"]]
 43 &then &goto select_example
 44 &else &goto display_menu
 45 
 46 
 47 &                              first-level invocation of this exec_com is above this line.
 48 &---------------------------------------------------------------------------------------------
 49 &                             second-level invocation of this exec_com is below this line.
 50 
 51 
 52 &label invoke_mrpg
 53 &command_line on
 54 &print
 55 &if [equal &2 1] &then &goto menu_1
 56 &if [equal &2 2] &then &goto menu_2
 57 &if [equal &2 3] &then &goto menu_3
 58 &if [equal &2 4] &then &goto menu_4
 59 &if [equal &2 5] &then &goto menu_5
 60 &--&if [equal &2 6] &then &goto menu_6
 61 &--&if [equal &2 7] &then &goto menu_7
 62 &--&if [equal &2 8] &then &goto menu_8
 63 
 64 &print run_mrpg_examples.ec:  Menu number selected (&2) is not in the menu.
 65 &quit
 66 
 67 
 68 &label menu_1
 69 archive xf >unbundled>mrpg_examples filing_cabinet.mrpg filing_cabinet.mrpg.input
 70 mrpg filing_cabinet -table
 71 &print ^/filing_cabinet has been generated and compiled.
 72 &print It may be executed by typing either
 73 &print ^10xfiling_cabinet
 74 &print ^5xor
 75 &print ^10xfiling_cabinet -file
 76 &print If the   -file   is omitted, the report will be displayed on your terminal.
 77 &print If the   -file   is typed, the report will be written into a segment named filing_cabinet.report
 78 &print If the   -file   choice is selected, then:
 79 &print ^5xTyping      print filing_cabinet.report     will display the report on your terminal.
 80 &print ^5xTyping     dprint filing_cabinet.report     will send the report to a line printer.
 81 &quit
 82 
 83 
 84 &label menu_2
 85 archive xf >unbundled>mrpg_examples two_reports.mrpg two_reports.mrpg.input
 86 mrpg two_reports -table
 87 two_reports
 88 &print ^/two_reports has been generated, compiled, and executed.
 89 &print The output is in   two_reports.file_one.report   and   two_reports.file_two.report
 90 &quit
 91 
 92 
 93 &label menu_3
 94 archive xf >unbundled>mrpg_examples hold_and_sort.mrpg hold_and_sort.mrpg.input
 95 mrpg hold_and_sort -table
 96 hold_and_sort
 97 &print ^/hold_and_sort has been generated, compiled, and executed.
 98 &print Print hold_and_sort.report
 99 &quit
100 
101 
102 &label menu_4
103 archive xf >unbundled>mrpg_examples begin_(1 8)_hold_assign.mrpg begin_9_hold_assign.mrpg.input
104 mrpg begin_(1 8)_hold_assign -table
105 begin_(1 8)_hold_assign
106 &print ^/begin_1_hold_assign has been generated, compiled, and executed.
107 &print   begin_8_hold_assign has been generated, compiled, and executed.
108 &print Print begin_1_hold_assign.in.report  and  begin_1_hold_assign.lv.report
109 &print Print begin_8_hold_assign.in.report  and  begin_8_hold_assign.lv.report
110 &quit
111 
112 
113 &label menu_5
114 archive xf >unbundled>mrpg_examples negative_parameter.mrpg negative_parameter.mrpg.input
115 mrpg negative_parameter -table
116 &print ^2/negative_parameter has been generated and compiled.
117 &print    Execute the object program without supplying any parameter.^2/
118 negative_parameter
119 &print ^2/Execute it with a positive argument.^2/
120 negative_parameter 5
121 &print ^2/Now execute it using the "negative" argument.^2/
122 negative_parameter 6 -neg
123 &print ^2/The parameters can be reversed.^2/
124 negative_parameter -neg 7
125 &quit