RosettaCodeData/Task/Detect-division-by-zero/RPGIV/detect-division-by-zero.rpgiv
2016-12-05 23:44:36 +01:00

17 lines
443 B
Text

dcl-c DIVIDE_BY_ZERO 00102;
dcl-s result zoned(5:2);
dcl-s value1 zoned(5:2);
dcl-s value2 zoned(5:2);
value1 = 10;
value2 = 0;
monitor;
eval(h) result = value1 / value2; // Using half rounding here for the eval result
on-error DIVIDE_BY_ZERO;
// Initialise the result to 0. Consider other messaging perhaps.
result = 0;
endmon;
*inlr = *on;