Microsoft KB Archive/35722

From BetaArchive Wiki

How to Invoke "_MSREMOVE" COBOL 3.0 Extension Subroutine

PSS ID Number: Q35722 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: The Microsoft COBOL Version 3.0 extension subroutine "_MSREMOVE" replaces the extension “REMOVE” found in earlier Microsoft COBOL 2.x Versions. This extension subroutine may be called from a COBOL program to delete an existing disk file. The syntax for this 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 The sample program below works correctly and generates no error message when compiled with the ANS85 directive.

More Information: In the example below, the name of the file to be deleted must be assigned to the variable name File-Name. If the file to be deleted is not in the default directory, the full pathname must be specified in the File-Name variable. The return value in MY-STATUS will be “00” if the file was deleted or “30” if the file was not deleted. The following is a code example: DATA DIVISION. WORKING-STORAGE SECTION. 01 MY-STATUS PIC 9(2). 01 FILE-NAME PIC X(80) VALUE “TEST.DAT”. PROCEDURE DIVISION. MAIN. CALL "_MSREMOVE" USING BY REFERENCE FILE-NAME, BY CONTENT LENGTH OF FILE-NAME, BY REFERENCE MY-STATUS. DISPLAY “FILE REMOVED” MY-STATUS. STOP RUN.

Additional reference words: 3.00 Copyright Microsoft Corporation 1993.