Microsoft KB Archive/35515

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

PSS ID Number: Q35515 Article last modified on 04-21-1993

3.00 | 3.00 MS-DOS | OS/2

Summary: The Microsoft COBOL Version 3.0 extension subroutine &quot;_MSEXIST&quot; replaces the extension “EXIST” found in earlier COBOL 2.x versions. This extension subroutine may be called from a COBOL program to check to see whether a specified file exists. The syntax for this call given in the file MS2-2.DOC (found on the Setup disk) will cause the MS COBOL Version 3.0 compiler to issue the following error message: Call parameter is literal (or LENGTH of) by content assumed Despite the warning message, the generated code may be used successfully. The following sample program works correctly and generates no error messages. The full name of the file must be assigned to the variable FILE-NAME. The returned value in MY-STATUS will be “00” if the file was present or “30” if the file does not exist. The code example is as follows: DATA DIVISION. WORKING-STORAGE SECTION. 01 MY-STATUS PIC 9(2). 01 FILE-NAME PIC x(80) VALUE “D:.DAT”. PROCEDURE DIVISION. MAIN. CALL &quot;_MSEXIST&quot; USING BY REFERENCE FILE-NAME, BY CONTENT LENGTH OF FILE-NAME, BY REFERENCE MY-STATUS. DISPLAY “FILE PRESENT” MY-STATUS. STOP-RUN.

Additional reference words: 3.00 Copyright Microsoft Corporation 1993.