Guardian Programmer's Guide

Table Of Contents
Manipulating File Names
Guardian Programmer’s Guide 421922-014
13 - 8
Resolving Names
The following examples show how the FILENAME_RESOLVE_ procedure expands
some file names. The examples assume default values of \SYSA.$OURVOL.MYSUB:
Overriding the Default Values
The FILENAME_RESOLVE_ procedure usually obtains the default values for the node
name, volume name, and subvolume name from the =_DEFAULTS DEFINE.
However, you can override these values by specifying the defaults parameter. This
parameter supplies the subvolume name itself and optionally the volume and node
names. (If the volume or node name is omitted, then the corresponding values from
the =_DEFAULTS DEFINE are used.) You can also use the defaults parameter to
specify an alternate defaults class DEFINE.
The following example uses alternate defaults. The name string or defaults DEFINE
would typically be a user-specified parameter to the program.
DEFAULTS ':=' PARAM2 FOR $LEN(PARAM2);
DEFAULTS^LENGTH := $LEN(PARAM2);
ERROR := FILENAME_RESOLVE_(PNAME:NAME^LENGTH,
FULLNAME:MAXLEN,
FULL^LENGTH,
!options!,
!override^name:length!,
!search:length!,
DEFAULTS:DEFAULTS^LENGTH);
IF ERROR <> 0 THEN ... !Error condition
Resolving Subvolume Names
You can treat the input string to the FILENAME_RESOLVE_ procedure as a
subvolume name by setting the subvol-resolve flag (bit 14) in the options
parameter to 1.
The following example checks the output of the FILENAME_SCAN_ procedure to see
whether it refers to a subvolume name. If so, the example sets the subvol-resolve
flag to 1 before calling FILENAME_RESOLVE_:
LITERAL MAXLEN = 256;
LITERAL ACCEPT^SUBVOLS = %B0000000000000010;
LITERAL RESOLVE^SUBVOL = %B0000000000000010;
.
.
OPTIONS := ACCEPT^SUBVOLS;
ERROR := FILENAME_SCAN_(STRING^BUFFER:STRING^LENGTH,
COUNT,
KIND,
Input File Name Output File Name
PROGA \SYSA.$OURVOL.MYSUB.PROGA
$THEIRVOL.OLDSUB.PROGA \SYSA.$THEIRVOL.OLDSUB.PROGA
\SYSB.$OURVOL.HERSUB.PROGA \SYSB.$OURVOL.HERSUB.PROGA