Guardian Programmer's Guide

Table Of Contents
Manipulating File Names
Guardian Programmer’s Guide 421922-014
13 - 22
Establishing the Start of a File-Name Search
make special provisions when searching for process names, set up an asynchronous
search, and report specific kinds of system or device errors encountered during a
search. The following paragraphs describe these options.
Specifying the Search Pattern
To use the FILENAME_FINDSTART_ procedure, you must pass to it the file name
pattern to search for, along with its length. The procedure returns a search ID that you
use to identify this search to the FILENAME_FINDNEXT_ and
FILENAME_FINDFINISH_ procedures. This method allows you to have up to 16
searches concurrently active.
The following example sets up a search for a file named PROGA in any subvolume in
the current default volume:
SEARCH^PATTERN ':=' "*.PROGA" -> @S^PTR;
PATTERN^LENGTH := @S^PTR '-' @SEARCH^PATTERN;
ERROR := FILENAME_FINDSTART_(SEARCH^ID,
SEARCH^PATTERN:PATTERN^LENGTH);
IF ERROR <> 0 THEN ... !Error condition
Setting the Resolution Level
You can specify the level at which file names are reported by the subsequent search.
To do this, you include the resolvelevel parameter in the FILENAME_FINDSTART_
procedure call. You set this value to the desired level as follows:
If, for example, the resolvelevel parameter is set to 0, then all file names found in
the subsequent search are resolved to the device, process, or logical device level.
That is, the resolved file names will not include the node name:
SEARCH^PATTERN ':=' "*.PROGA" -> @S^PTR;
PATTERN^LENGTH := @S^PTR '-' @SEARCH^PATTERN;
RESOLVE^LEVEL := 0;
ERROR := FILENAME_FINDSTART_(SEARCH^ID,
SEARCH^PATTERN:PATTERN^LENGTH,
RESOLVE^LEVEL);
IF ERROR <> 0 THEN ... !Error condition
Note that the resolve level must not be to the right of a part of the search pattern that
contains a wild-card character or error 590 (invalid parameter) occurs. For example, if
the resolve level is zero, then the search pattern must not contain wild-card characters
in the node name.
-1 Specifies the node name level
0 Specifies the device, process, or logical device level
1 Specifies the first qualifier (subvolume for a disk device)
2 Specifies the second qualifier (file ID for a disk device)