Divide by zero operations in VISION:Results explained.
When dividing by zero, the DYLINSTL parameter ZDIVAB controls whether the job ABENDs or produces output.
The default is O which utilizes automatic recovery, changes the divisor to 1 and sets the return code to 0.
Alternate settings for this site level parameter are R, which also changes the divisor to 1, but sets the return code to 4, or Y, which forces a U0299 abend.
The site level setting may be overridden at the application level using OPTION parameters ZIDIVRC or ZDIVAB or ZDIVORG.
In non-abend cases, the automatic FIXED DECIMAL DIVIDE counter is incremented.
This table shows what you will get if you divide a number by 0, using a single value of 12 as the dividend for this example:
QUOTIENT = DIVIDEND / DIVISOR Return Code DIVIDEND DIVISOR QUOTIENT FIXED DECIMAL
DIVIDE DYLINSTL ZDIVAB=O or OPTION ZDIVORG 0 12 0 12 1 DYLINSTL ZDIVAB=R or OPTION ZDIVRC 4 12 0 12 1 DYLINSTL ZDIVAB=Y or OPTION ZDIVAB U0299 - - - -
If other results are desired then the divisor should be validated in the program before the divide and appropriate action in the program