Task

Write a function to detect a   divide by zero error   without checking if the denominator is zero.




 
       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;  
 