Microsoft KB Archive/60865

ACCEPTing a Blank in a PIC Z Causes Error 105 and Hangs

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

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

Summary: A standard (non-Screen) ACCEPT of a PIC Z (or PIC 09) clause can cause a memory-allocation error when a blank (or other nonnumeric) is entered. In DOS or OS/2 real mode, this causes a run-time error and soft-hangs the computer. In OS/2 protected mode, the following system error occurs and stops the process: SYS1942: A program attempted to reference storage outside the limits of a stack segment. The program was ended. TRAP 000C Microsoft has confirmed this to be a problem in Microsoft COBOL Compiler versions 3.0 and 3.0a for MS-DOS and MS OS/2. This problem has been corrected in Microsoft COBOL Professional Development System version 4.0.

More Information: In a related problem in OS/2 protected mode, ACCEPTing (non-screen) a valid numeric (0-9) into a PIC Z (or PIC 09) after a Screen ACCEPT causes the following system error and stops the process: SYS1943: A program caused a protection violation. TRAP 000D ACCEPTing a valid numeric into a PIC Z after a screen ACCEPT works correctly in DOS or OS/2 real mode.

Code Example
The following code example demonstrates the two problems described above: WORKING-STORAGE SECTION. 01 JUNK PIC X. ''Same behavior with PIC 09 instead of PIC Z 01 NUMEDIT-FAIL PIC Z. SCREEN SECTION. 01 PICZ-SCREEN. 05 BLANK SCREEN. 05 LINE 1 COLUMN 1 PIC X TO JUNK. PROCEDURE DIVISION. MAIN. '' Screen ACCEPT necessary for 2nd problem in OS/2 DISPLAY PICZ-SCREEN. ACCEPT PICZ-SCREEN. * Enter a blank for 1st problem in DOS or OS/2 * Enter any number for the 2nd problem in OS/2 ACCEPT NUMEDIT-FAIL. STOP RUN.

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