Top
NetCOBOL V11.0 CBL Subroutines User's Guide
FUJITSU Software

3.2 CBL_SPLIT_FILENAME

This routine splits a file name into components (i.e., device name, basic name, extension).

Specification

Parameter data definition
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.
Calling format
CALL "CBL_SPLIT_FILENAME"
    USING split-join-parameters
          split-name-buffer
    RETURNING status-code.

Interface

split-join-parameters
parameter-length

Specifies the length of split/join parameters. The standard value is 24.

split-join-flag-1

Specifies the information of split-join-flag-1 in units of bits as follows:

Bit 0
  • ON: The file name using uppercase characters is returned.

  • OFF: The file name using specified characters is returned.

Bit 1
  • ON: The file name string ends with a null character.

  • OFF: The file name string ends with a blank character.

split-join-flag-2

Specifies the area to store the information of split-join-flag-2. The information to be stored is as follows:

Bit 1
  • ON: A wild card is found in device name.

  • OFF: No wild card is found in device name.

Bit 2
  • ON: A wild card is found in basic name or extension.

  • OFF: No wild card is found in basic name and extension.

relative-address-of-device-name

Specifies the area to store the relative address of device name from the head of the split-name-buffer.

device-name-length

Specifies the area to store the length of device name.

relative-address-of-basic-name

Specifies the area to store the relative address of basic name from the head of the split-name-buffer.

basic-name-length

Specifies the area to store the length of basic name.

relative-address-of-extension

Specifies the area to store the relative address of extension from the head of the split-name-buffer.

extension-length

Specifies the area to store the length of extension.

total-length

Specifies the area to store the total number of file name characters.

split-name-buffer-size

Specifies the size of split-name-buffer. The maximum value is 255.

joined-name-buffer-size

Specifies the size of joined-name-buffer.

length-of-first-path-name-component

Specifies the area to store the number of characters from the head of the file name until the first "\", "/", or ":".

split-name-buffer

Specifies the split-name-buffer.

Return code

The return code is set in the status-code specified in the RETURNING clause.

status-code
  • 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.