Guardian Programmer's Guide

Table Of Contents
Manipulating File Names
Guardian Programmer’s Guide 421922-014
13 - 18
Modifying Portions of a File Name
SUBPART);
IF ERROR <> 0 THEN ... !Error condition
Extracting Pieces of File Names: Some Examples
The following examples list some file names and the corresponding output from the
FILENAME_DECOMPOSE_ procedure. The examples assume that the current
default values are \SYS.$OURVOL.MYSUB:
Modifying Portions of a File Name
To modify a piece of a file name, use the FILENAME_EDIT_ procedure.
You must specify the piece of the file name you need to modify and the character string
that replaces that piece. If the replacement string is zero length, then the piece is
simply removed (leaving the correct number of part separator characters).
The input string contains the file name you need to modify. The name can be fully or
partially qualified. If the name is partially qualified, then the system applies the default
values from the =_DEFAULTS DEFINE. You can therefore edit any part of the fully
qualified name, even if the input string contained a partially qualified name. An invalid
input string might cause error 13 to be returned.
The piece of the file name that you replace can be a file-name part, a file-name suffix,
a file-name prefix, or a subpart of a process descriptor. The following paragraphs
show how.
Input Name
Leve
l
Option
s Subpart Output Element(s)
$YOURVOL.HISSUB.FILEA 0 $YOURVOL
$YOURVOL.HISSUB.FILEA 0 suffix $YOURVOL.HISSUB.FILEA
FILE1 0 $OURVOL
FILE1 0 suffix $OURVOL.MYSUB.FILE1
FILE1 0 prefix \SYS.$OURVOL
$P:4321.#A 0 $P:4321
$P:4321.#A 0 4 $P
Caution. Passing an invalid file name or file-name pattern to the FILENAME_EDIT_
p
rocedure can result in a signal, trap, or data corruption. To verify that a file name is valid, use
the FILENAME_SCAN_ procedure.