Guardian Programmer's Guide

Table Of Contents
Manipulating File Names
Guardian Programmer’s Guide 421922-014
13 - 15
Extracting Pieces of File Names
ALT^DEFAULTS);
IF ERROR <> 0 THEN ... !Error condition
Truncating Default Parts of File Names: Some Examples
The following examples show how the FILENAME_UNRESOLVE_ procedure deals
with file names, given that the default values are \SYSA.$OURVOL.MYSUB:
Extracting Pieces of File Names
To extract pieces of file names, use the FILENAME_DECOMPOSE_ procedure. You
pass the file name to the procedure along with an indication of the piece of the file
name that you want to extract. The procedure returns the extracted piece. With
normal use, a partially qualified file name is implicitly resolved; parts of the file name
not specified in the input string can therefore be returned using the default values.
You can use the FILENAME_DECOMPOSE_ procedure to extract a single part of a file
name, a file-name suffix, a file-name prefix, or a subpart of a process descriptor.
Although file names are normally implicitly qualified, you can choose to extract file-
name pieces without implicit resolution. The following paragraphs describe these
options.
Extracting a File-Name Part
To extract one part of a file name, you need to supply the FILENAME_DECOMPOSE_
procedure with the file name and the level of the part you want to extract. No
additional options are necessary.
The following example extracts the subvolume name from a file name:
LITERAL MAXLEN = 16;
LITERAL SUBVOL^LEVEL = 1;
.
.
Input File Name
Leve
l Output File Name
\SYSA.$OURVOL.MYSUB.PROGB 0 $OURVOL.MYSUB.PROGB
\SYSB.$YOURVOL.HISSUB.FILEA 0 \SYSB.$YOURVOL.HISSUB.FILEA
\SYSA.$THEIRVOL.HERSUB.FILEB 0 $THEIRVOL.HERSUB.FILEB
\SYSA.$OURVOL.RECORDS.LOGFILE 2 RECORDS.LOGFILE
RECORDS.LOGFILE 0 RECORDS.LOGFILE
MYSUB.PROGA 1 MYSUB.PROGA
MYSUB.PROGA 2 PROGA
Caution. Passing an invalid file name or file-name pattern to the FILENAME_DECOMPOSE_
p
rocedure can result in a signal, trap, or data corruption. To verify that a file name is valid, use
the FILENAME_SCAN_ procedure.