Microsoft KB Archive/35723

How to Invoke &quot;_MSCOMMAND&quot; COBOL 3.0 Extension Subroutine

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

3.00 | 3.00 MS-DOS | OS/2

Summary: The Microsoft COBOL Version 3.0 extension subroutine &quot;_MSCOMMAND&quot; replaces the extension “COMMAND” found in earlier Microsoft COBOL 2.x Versions. This extension subroutine may be called from a COBOL program to determine the command line that was entered to start the program. The returned command line will include the full pathname and the name of the program as well as any arguments that were passed to the program. The syntax for the &quot;_MSCOMMAND&quot; call given in the file MS2-2.DOC (found on the Setup disk) will cause the compiler to issue the following error message: Call parameter is literal (or LENGTH of) By content assumed Despite this warning message, the generated code may be used successfully. The sample program below works correctly and generates no error messages when compiled with the ANS85 directive.

More Information: In the example below, the full command line is returned in the variable COMM-LINE. The following is a code example: DATA DIVISION. WORKING-STORAGE SECTION. 01 COMM-LINE PIC X(80). PROCEDURE DIVISION. MAIN. CALL &quot;_MSCOMMAND&quot; USING BY REFERENCE COMM-LINE, BY CONTENT LENGTH OF COMM-LINE. DISPLAY “COMMAND LINE WAS” COMM-LINE. STOP RUN.

Additional reference words: 3.00 Copyright Microsoft Corporation 1993.