Microsoft KB Archive/50227

COBOL Program Can Hang When Using CTRL+C After CTRL+S

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

3.00 3.00a MS-DOS

Summary: The following sequence of events causes a program to hang, displaying a “Divide Overflow” message in DOS versions 3.1 and 3.3. You must do a cold boot to restart the machine under these versions. In DOS 4.0 and 4.01, no message appears and you can reboot with a warm boot. 1. Run the program. 2. Press CTRL+S to pause the program. 3. Press CTRL+C to break out of the program. 4. Run the program again (this is where the computer hangs). Microsoft has confirmed this to be a problem in COBOL versions 3.0 and 3.0a running under the versions of MS-DOS mentioned above. The problem does not occur with a program running under MS OS/2. This problem was corrected in Microsoft COBOL Professional Development System version 4.0 for MS-DOS and MS OS/2.

More Information: You can test this behavior by performing the above steps on the following program: PROCEDURE DIVISION. MAIN. PERFORM THE-LOOP 1000 TIMES. STOP RUN. THE-LOOP. DISPLAY “I’M GONNA HANG” One way to avoid the problem is to never press CTRL+C while the program is paused with CTRL+S. Also, if you press CTRL+S to pause followed by CTRL+Q to disable the pause, then you may break out of the program safely with CTRL+C. A second way to avoid the problem is to trap the CTRL+S key sequence, thus disabling the ability to pause the program. For an example of trapping CTRL+S, query on the following words: CTRL+S and TRAP and TERMINATE and ACCEPT and COBOL and 3.00 You cannot be prevented from using CTRL+C to break out of the program because this key sequence cannot be trapped.

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