Microsoft KB Archive/34605

From BetaArchive Wiki

Don’t Compile CALL X“91” Special Functions with MS[1] or MS[2]

PSS ID Number: Q34605 Article last modified on 04-21-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: In COBOL Version 3.0, special functions must not be compiled using the MS[1] or the MS[2] dialect switch (run-time error message 181). CALL X“91” requires that several parameters be set before execution. The parameter that describes the length of the filename must be reset prior to each CALL because that parameter is changed during the call. Failure to reset the parameter causes a variety of errors ranging from display of the command-line prompt to hanging of the program. In the code example below, the only parameter that needs to be reset is PARM1. None of the documentation specifies which parameters are changed for any of the special functions. Caution is therefore recommended when using any of these functions.

More Information: The following is the code example: IDENTIFICATION DIVISION. PROGRAM-ID. T-CHAIN. DATA DIVISION. WORKING-STORAGE SECTION. 01 FUNCTION PIC 99 COMP VALUE 35. 01 RESULT PIC 99 COMP-X VALUE 0. 01 PARAM. 03 PARM1 PIC 99 COMP-X VALUE 12. 03 PARM2 PIC X(13) VALUE “C:”. 01 MYMSG PIC X(13) VALUE IS “PRESS RETURN”. 01 INKEY PIC X(9). PROCEDURE DIVISION. MAIN. perform cycle until inkey=“CntlBreak”. stop-run. cycle. DISPLAY SPACES UPON CRT. DISPLAY AT 1010 MYMSG. ACCEPT INKEY. MOVE 12 to PARM1. CALL X“91” USING RESULT, FUNCTION, PARAM. DISPLAY AT 1010 RESULT. * Should display 0 for correct operations.

Additional reference words: 3.00 Copyright Microsoft Corporation 1993.