Guardian Programmer's Guide

Table Of Contents
Manipulating File Names
Guardian Programmer’s Guide 421922-014
13 - 11
Resolving Names
Rejecting DEFINEs That are not Resolved to a File Name
You have the option to reject any DEFINEs that are not resolved to a file name. You
set the DEFINE-reject flag (bit 10) in the options parameter to 1 to request this
feature. Instead of returning the name of such a DEFINE, FILENAME_RESOLVE_
returns error 13. This option can be used alone or with the preceding options.
The following example modifies the example given for the DEFINE-reduction flag
by rejecting DEFINEs that do not reference a file name:
LITERAL DEFINE^REDUCTION = %B0000000000010000;
LITERAL DEFINE^REJECT = %B0000000000100000;
.
.
OPTIONS := DEFINE^REDUCTION LOR DEFINE^REJECT;
ERROR := FILENAME_RESOLVE_(NAME:NAME^LENGTH,
FULLNAME:MAXLEN,
FULL^LENGTH,OPTIONS);
IF ERROR <> 0 THEN
CASE ERROR OF
BEGIN
13 -> !DEFINE mode turned off, or
! no file name referenced
198 -> !No such DEFINE
OTHERWISE -> !Other error
END;
Searching and Resolving File Names
You can perform file-name resolution by searching a list of subvolumes contained in a
search DEFINE. You specify the DEFINE in the search parameter of the
FILENAME_RESOLVE_ procedure. Refer to Section 7, Using DEFINEs, for a
description of search DEFINEs.
If the specified search DEFINE exists and DEFINE mode is turned on, then the system
searches the subvolume list contained in the DEFINE for the file named in the input
string. Note that searching is done only if the input string contains only the file ID (last
part) of a file name.
The search proceeds as follows. The system searches the first subvolume listed in the
search DEFINE. If a match is found, then the file name is resolved using that
subvolume. If no match is found, the search continues with the next listed subvolume.
If the search finishes without finding a match, error 11 (file not in directory) is normally
returned.
The search is skipped without returning an error if one of the following conditions is
true:
The input string does not contain just a valid file ID.
The search DEFINE length is zero.
The search DEFINE does not exist.