Microsoft KB Archive/37406

From BetaArchive Wiki
< Microsoft KB Archive
Revision as of 18:54, 18 July 2020 by 3155ffGd (talk | contribs) (importing KB archive)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

CANCEL after CALL Can Hang at Run Time in COBOL 3.0

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

3.00 | 3.00 MS-DOS | OS/2

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

Summary: If the CANCEL statement comes immediately after the CALL statement, given the following conditions, the compiled program may hang when executed: 1. The CALLed subprogram must be dynamically linked. 2. Both the CALLing and CALLed programs must be dynamically linked to the ADIS.EXE Accept/Display support file. 3. There is a DISPLAY AT statement directly after the CANCEL statement in the CALLing program.

More Information: Microsoft has confirmed this to be a problem in Version 3.0. This problem was corrected in Version 3.0a. This problem does not occur when the CANCEL statement comes after the DISPLAY AT Line/Column or if both programs are hardlinked to the ADIS support file as in the following example: LINK progname+ADIS+ADISINIT+ADISKEY; To demonstrate the problem, use the default compiler directives (except for “ANS85”), and do not LINK the ADIS support files directly; instead, softlink to the ADIS.EXE file. The following programs should be compiled and linked: COBOL DRIVER; LINK DRIVER; COBOL SUBPROG; LINK SUBPROG; Executing the first program will hang the machine after the first call to the subprogram. The following is the code for the main program, DRIVER.CBL: $SET ANS85 IDENTIFICATION DIVISION. PROGRAM-ID. DRIVER. DATA DIVISION. WORKING-STORAGE SECTION. 01 PASS-VALUE PIC 9(6) VALUE 0. PROCEDURE DIVISION. MAIN. PERFORM UNTIL PASS-VALUE = 100 CALL “SUBPROG.EXE” USING BY REFERENCE PASS-VALUE * If the CANCEL STATEMENT is here and the Line/Column * is specified on the DISPLAY line, the system will * hang. CANCEL “SUBPROG” DISPLAY PASS-VALUE AT 2020 * However, it works correctly if the CANCEL STATEMENT * is here and/or the DISPLAY coordinates are removed. * DISPLAY PASS-VALUE AT 2020 * CANCEL “SUBPROG.EXE” END-PERFORM. STOP RUN. The following is the code for the CALLed subprogram, SUBPROG.CBL: IDENTIFICATION DIVISION. PROGRAM-ID. SUBPROG. DATA DIVISION. LINKAGE SECTION. 01 DUMMY-3 PIC 9(6). PROCEDURE DIVISION USING DUMMY-3. ADD 1 TO DUMMY-3. END PROGRAM SUBPROG.

Additional reference words: 3.00 Copyright Microsoft Corporation 1993.