Microsoft KB Archive/38959

From BetaArchive Wiki
< Microsoft KB Archive
Revision as of 19:22, 12 August 2020 by X010 (talk | contribs) (X010 moved page Microsoft KB Archive/Q38959 to Microsoft KB Archive/38959 without leaving a redirect: Text replacement - "Microsoft KB Archive/Q" to "Microsoft KB Archive/")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Running MS-DOS Executable Files with CALL X“91” in COBOL 3.0

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

3.00 3.00a MS-DOS

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

Summary: Using the CALL X“91” with function 35, you can call and execute any executable file (.COM or .EXE program) or batch file (.BAT) that can be run from the MS-DOS command line. (This feature is analogous to the SHELL statement in QuickBASIC or GW-BASIC for the IBM PC.)

More Information: See Pages 8-9 to 8-14 (INTER-PROGRAM FUNCTION CALLS) in the “Microsoft COBOL Compiler 3.0: Operating Guide” for this and more information. The statement is used as follows: CALL X“91” USING result,function,parameter This statement is defined as follows: 1. “Result” is a PIC 99 COMP-X field that contains 0 (zero) if the call is successful, or nonzero if it is unsuccessful. The number returned varies according to the function used. 2. “Function” is a PIC 99 COMP-X field that contains the function number. In this case, it is 35. A list of other functions for this call is on Page 8-9 of the “Microsoft COBOL Compiler 3.0: Operating Guide.” 3. Parameter is a PIC X field of variable length and depends on the associated function. 4. In this case, the parameter field is a group item consisting of the following two data items: a. A PIC 99 COMP-X field that specifies the number of characters in the filename. If this is set to 0, then whatever has been previously written to the command line using DISPLAY … UPON COMMAND-LINE is executed. b. A PIC X field of variable length that contains the filename. Upon executing the EXE file, control is passed back to the calling COBOL program. The following is a code example: WORKING-STORAGE SECTION. 01 RESULT PIC 99 COMP-X VALUE ZERO. 01 FUNCTION PIC 99 COMP-X VALUE 35. 01 PARAMETER. 03 LENGTH-1 PIC 99 COMP-X VALUE 7. 03 FILENAME PIC X(20) VALUE “PRT.BAT”. PROCEDURE DIVISION. PERFORM PRINT-PARA 3 TIMES. STOP RUN. PRINT-PARA. MOVE ZERO TO RESULT. MOVE 35 TO FUNCTION. MOVE 7 TO LENGTH-1. MOVE “PRT.BAT” TO FILENAME. CALL X“91” USING RESULT, FUNCTION, PARAMETER. DISPLAY “BACK FROM THE CALL X”91" FROM COBOL 3.0". DISPLAY RESULT.

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