1 /* begin_1_hold_assign.mrpg contains one hold statement.
2 * begin_8_hold_assign.mrpg contains eight holds, one per phase.
3 * These two MRPG programs illustrate the interactions between:
4 * -- hold statements
5 * -- assignment statements inside begin parentheses
6 * -- assignment statements in execute loop
7 *
8 * "in_" denotes input field; "lv_" denotes local variable.
9 * Report names for _1_ version are begin_1_hold_assign.in lv.report
10 * Report names for _8_ version are begin_8_hold_assign.in lv.report
11 */
12 dcl 1 input stream file "begin_9_hold_assign.mrpg.input",
13 2 in_1 dec2, 2 in_2 dec2, 2 in_3 dec2, 2 in_4 dec2;
14 dcl lv_1 dec; dcl lv_2 dec; dcl lv_3 dec; dcl lv_4 dec;
15 dcl phase dec; dcl input_record_number dec;
16 define 1 report in_report on file "begin_1_hold_assign.in.report",
17 2 detail in_data_line, 3 line,
18 4 "Phase ", 4 phase, 4 "- Record ", 4 input_record_number,
19 4 " in_1 = ", 4 in_1, 4 " in_2 = ", 4 in_2,
20 4 " in_3 = ", 4 in_3, 4 " in_4 = ", 4 in_4,
21 3 line if input_record_number = 2; /* Blank line between phases. */
22 define 1 report lv_report on file "begin_1_hold_assign.lv.report",
23 2 detail lv_data_line, 3 line,
24 4 "Phase ", 4 phase, 4 "- Record ", 4 input_record_number,
25 4 " lv_1 = ", 4 lv_1, 4 " lv_2 = ", 4 lv_2,
26 4 " lv_3 = ", 4 lv_3, 4 " lv_4 = ", 4 lv_4,
27 3 line if input_record_number = 2; /* Blank line between phases. */
28
29
30 /* ----- PHASE 1 ----- */
31 begin phase := 1; input_record_number := 0;
32 lv_1 := 85; lv_2 := 86; lv_3 := 87; lv_4 := 88;
33
34 input_record_number := input_record_number + 1;
35 print in_report; print lv_report;
36 hold in_1, in_2, lv_1, lv_2; /* Same in _1_ and _8_ versions. */
37
38
39 /* ----- PHASE 2 ----- */
40 begin phase := phase + 1; input_record_number := 0;
41
42 input_record_number := input_record_number + 1;
43 print in_report; print lv_report;
44 /*,,,hold;,,,*/ /* This "hold;" statement is executed in the
45 * _8_ version of this program. */
46
47
48 /* ----- PHASE 3 ----- */
49 begin phase := phase + 1; input_record_number := 0;
50 in_1 := in_1 + 1; in_3 := in_3 + 1;
51 lv_1 := lv_1 + 1; lv_3 := lv_3 + 1;
52
53 input_record_number := input_record_number + 1;
54 print in_report; print lv_report;
55 /*,,,hold;,,,*/ /* This "hold;" statement is executed in the
56 * _8_ version of this program. */
57
58
59 /* ----- PHASE 4 ----- */
60 begin phase := phase + 1; input_record_number := 0;
61
62 input_record_number := input_record_number + 1;
63 print in_report; print lv_report;
64 /*,,,hold;,,,*/ /* This "hold;" statement is executed in the
65 * _8_ version of this program. */
66
67
68 /* ----- PHASE 5 ----- */
69 begin phase := phase + 1; input_record_number := 0;
70
71 input_record_number := input_record_number + 1;
72 in_2 := in_2 + 1; in_4 := in_4 + 1;
73 lv_2 := lv_2 + 1; lv_4 := lv_4 + 1;
74 print in_report; print lv_report;
75 /*,,,hold;,,,*/ /* This "hold;" statement is executed in the
76 * _8_ version of this program. */
77
78
79 /* ----- PHASE 6 ----- */
80 begin phase := phase + 1; input_record_number := 0;
81
82 input_record_number := input_record_number + 1;
83 print in_report; print lv_report;
84 /*,,,hold;,,,*/ /* This "hold;" statement is executed in the
85 * _8_ version of this program. */
86
87
88 /* ----- PHASE 7 ----- */
89 begin phase := phase + 1; input_record_number := 0;
90 in_1 := in_1 + 1; in_3 := in_3 + 1;
91 lv_1 := lv_1 + 1; lv_3 := lv_3 + 1;
92
93 input_record_number := input_record_number + 1;
94 in_1 := in_1 + 1; in_3 := in_3 + 1;
95 lv_1 := lv_1 + 1; lv_3 := lv_3 + 1;
96 print in_report; print lv_report;
97 /*,,,hold;,,,*/ /* This "hold;" statement is executed in the
98 * _8_ version of this program. */
99
100
101 /* ----- PHASE 8 ----- */
102 begin phase := phase + 1; input_record_number := 0;
103
104 input_record_number := input_record_number + 1;
105 print in_report; print lv_report;
106 /*,,,hold;,,,*/ /* This "hold;" statement is executed in the
107 * _8_ version of this program. */
108 end;