This routine splits a file name into components (i.e., device name, basic name, extension).
Specification
01 split-join-parameters. 02 parameter-length PIC 9(4) BINARY. 02 split-join-flag-1 PIC 9(2) BINARY. 02 split-join-flag-2 PIC 9(2) BINARY. 02 relative-address-of-device-name PIC 9(4) BINARY. 02 device-name-length PIC 9(4) BINARY. 02 relative-address-of-basic-name PIC 9(4) BINARY. 02 basic-name-length PIC 9(4) BINARY. 02 relative-address-of-extension PIC 9(4) BINARY. 02 extension-length PIC 9(4) BINARY. 02 total-length PIC 9(4) BINARY. 02 split-name-buffer-size PIC 9(4) BINARY. 02 joined-name-buffer-size PIC 9(4) BINARY. 02 length-of-first-path-name-component PIC 9(4) BINARY. 01 split-name-buffer PIC X(n). 01 status-code PIC S9(4) COMP-5.
CALL "CBL_SPLIT_FILENAME" USING split-join-parameters split-name-buffer RETURNING status-code.
Interface
Specifies the length of split/join parameters. The standard value is 24.
Specifies the information of split-join-flag-1 in units of bits as follows:
ON: The file name using uppercase characters is returned.
OFF: The file name using specified characters is returned.
ON: The file name string ends with a null character.
OFF: The file name string ends with a blank character.
Specifies the area to store the information of split-join-flag-2. The information to be stored is as follows:
ON: A wild card is found in device name.
OFF: No wild card is found in device name.
ON: A wild card is found in basic name or extension.
OFF: No wild card is found in basic name and extension.
Specifies the area to store the relative address of device name from the head of the split-name-buffer.
Specifies the area to store the length of device name.
Specifies the area to store the relative address of basic name from the head of the split-name-buffer.
Specifies the area to store the length of basic name.
Specifies the area to store the relative address of extension from the head of the split-name-buffer.
Specifies the area to store the length of extension.
Specifies the area to store the total number of file name characters.
Specifies the size of split-name-buffer. The maximum value is 255.
Specifies the size of joined-name-buffer.
Specifies the area to store the number of characters from the head of the file name until the first "\", "/", or ":".
Specifies the split-name-buffer.
Return code
The return code is set in the status-code specified in the RETURNING clause.
0: Successful
4: File name invalid
Example
If "A:\Example\Master.Doc" is stored in split-name-buffer, this subroutine is processed as follows.
relative-address-of device-name will be set 1. Device-name-length will be set 10. Relative-address-of-basic-name will be set 12. Basic-name-length will be set 6. Relative-address-of-extension will be set 19. Extention-length will be set 3.