Microsoft KB Archive/59134

CALL X“8C” Fails to Split Directory with Extension

PSS ID Number: Q59134 Article last modified on 11-29-1990

3.00 3.00a MS-DOS

Summary: The CALL X“8C” function in Microsoft COBOL versions 3.00 and 3.00a does not correctly work on a path specification that contains a directory name with an extension. This information applies to Microsoft COBOL Compiler versions 3.00 and 3.00a for MS-DOS.

More Information: The CALL X“8C” function in Microsoft COBOL versions 3.00 and 3.00a splits a filename. For example, if you pass the filename C:.CBL to the function, the name is split to the following: Path: C:

Filename: MYPROG Extension: CBL However, if the directory given for the path has an extension, the CALL X“8C” function will fail to split the name. For example, the path C:.TST.CBL is not be split. The code below demonstrates the problem. Compile and link the program as follows: COBOL spath.cbl ; LINK spath ; The following program, SPATH.CBL, demonstrates the problem: $set errq MS(2) ANS85 IDENTIFICATION DIVISION. PROGRAM-ID. TESTPROG. ENVIRONMENT DIVISION. CONFIGURATION SECTION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT FILE-IN ASSIGN TO FILESPEC FILE STATUS IS FILE-STATUS ORGANIZATION IS SEQUENTIAL. DATA DIVISION. FILE SECTION. FD FILE-IN. 01 LETTER PIC X. WORKING-STORAGE SECTION. 77 FILESPEC PIC X(42). 77 PATH PIC X(30). 77 FILENAME PIC X(10). 77 FILE-EXT PIC X(5). 77 FILE-STATUS PIC XX. PROCEDURE DIVISION. ACCEPT FILESPEC FROM COMMAND-LINE. OPEN INPUT FILE-IN. EXHIBIT NAMED FILESPEC, FILE-STATUS. IF FILE-STATUS = “00” THEN CLOSE FILE-IN. CALL X“8C” USING FILESPEC, PATH, FILENAME, FILE-EXT. EXHIBIT NAMED PATH, FILENAME, FILE-EXT. STOP RUN. Run SPATH with and without supplying a path extension, as follows: SPATH d:<- this works correctly SPATH d:.tst<- this demonstrates the problem

Copyright Microsoft Corporation 1990.