Microsoft KB Archive/51730

From BetaArchive Wiki

COBOL 3.0 and 3.0a Will Not Produce “Divide by Zero” Error

PSS ID Number: Q51730 Article last modified on 04-20-1993

3.00 3.00a | 3.00 3.00a MS-DOS | OS/2

The information in this article applies to:
- Microsoft COBOL for MS-DOS and OS/2, versions 3.0 and 3.0a

Summary: In COBOL Versions 3.0 and 3.0a, it is legal to divide by zero. That is why there is no “Divide by zero” error documented in the “Microsoft COBOL Compiler 3.0: Operating Guide.” If this error message is generated during the execution of a COBOL Version 3.0 or 3.0a program, it means that the hardware generated the error, not the software. In Microsoft COBOL Versions 3.0 and 3.0a, dividing by zero will yield a result of zero.

More Information: The following program, TEST.CBL, will execute without producing a “Divide by zero” error. DATA DIVISION. WORKING-STORAGE SECTION. 01 NUMBER PIC 9 VALUE 1 PROCEDURE DIVISION. COMPUTE NUMBER = NUMBER / 0. DISPLAY NUMBER. STOP RUN. To compile and link the program, use the following command lines: COBOL TEST.CBL ; LINK TEST.CBL ; When run, a 0 (zero) will be displayed.

Additional reference words: 3.00 3.00a Copyright Microsoft Corporation 1993.