CHECKDIV

Controls the behavior of your program if it tries to divide by zero in a statement that has no ON SIZE ERROR phrase.

Syntax:

>>-.---.-.-------CHECKDIV-"dialect"-.-----><
   +-/-+ +.----.-CHECKDIV-----------+
          +-NO-+

Parameters:

dialect
One of ACOS, ANSI, ISO2002, COBOL370, ENTCOBOL, MVS, OS390, OSVS, VSC2 .

Properties:

Default: CHECKDIV"ANSI"
Phase: Syntax check
$SET: Initial

Comments:

This directive has no effect on arithmetic statements that use the ON SIZE ERROR phrase.

With CHECKDIV, CHECKDIV"ANSI" or CHECKDIV"ISO2002" specified, the program continues with an undefined result if it tries to divide by zero. With NOCHECKDIV set, the behavior is undefined.

Specifying CHECKDIV"COBOL370", CHECKDIV"ENTCOBOL", CHECKDIV"MVS", CHECKDIV"OS390", CHECKDIV"OSVS" or CHECKDIV"VSC2" has the same effect; trying to divide by zero produces run-time error 048 (Attempt to divide by zero). This error can be disabled using the -O run-time system switch.

With CHECKDIV"ACOS" specified, both the quotient and the remainder are assigned the value of the dividend. The NUMPROC"ACOS" directive provides further ACOS mainframe compatibility.

Setting NOCHECKDIV results in optimal code for divides.