1 /* Illustrate a method that permits the user to supply a
2 * negative value for a parameter.
3 */
4 dcl 1 parm, 2 the_parameter char*, 2 neg_key bool key "-neg";
5 /* The input data is not used within this program, but is declared
6 * because the MRPG language requires that an input file be declared
7 * in every MRPG program.
8 */
9 dcl 1 input file "negative_parameter.mrpg.input", 2 dummy_data char10;
10 dcl actual_value dec;
11 define 1 report the_report pgl 2 on switch "user_output",
12 2 detail the_detail, 3 line, 4 "Parameter value = " || actual_value;
13 begin
14 /* Convert this comment into an active statement when the else capability
15 * in MRPG is repaired and delete the two if statements following
16 * this comment.
17 *
18 * if neg_key then actual_value := - the_parameter;
19 * else actual_value := the_parameter; fi;
20 */
21 if neg_key then actual_value := - the_parameter; fi;
22 if not neg_key then actual_value := the_parameter; fi;
23 print the_report; end;