Guardian Programmer's Guide

Table Of Contents
Manipulating File Names
Guardian Programmer’s Guide 421922-014
13 - 23
Establishing the Start of a File-Name Search
Setting Up a Search for a Specific Type of Device
The FILENAME_FINDSTART_ procedure allows you to restrict the output of a search
to files of a specified device type or subdevice type. In addition, if you set the
not-device-type flag (bit 14) or the not-subdevice-type flag (bit 13) in the
options parameter, you can restrict the report to all but the specified device type and
subdevice type.
You specify the device type you want in the devtype parameter. You specify the
subdevice in the subdevtype parameter.
These device-restricting options are most useful when restricting searches to disk files.
However, these options can also be used for devices other than disks, but with
restrictions as described below in Searching for Files Not on Disk. The following
paragraphs describe how to use the device-restricting options.
Searching for Disk Files
The recommended use of the device-restricting options is to limit a search to disk-file
names. You can significantly reduce the search time by not attempting to match a
pattern with the names of files not on disk if you know that the files you are searching
for are disk files.
By setting the devtype parameter to 3, you restrict the search to disk files:
SEARCH^PATTERN ':=' "$*.*.PROGA" -> @S^PTR;
PATTERN^LENGTH := @S^PTR '-' @SEARCH^PATTERN;
RESOLVE^LEVEL := 0;
DEVICE^TYPE := 3;
ERROR := FILENAME_FINDSTART_(SEARCH^ID,
SEARCH^PATTERN:PATTERN^LENGTH,
RESOLVE^LEVEL,DEVICE^TYPE);
IF ERROR <> 0 THEN ... !Error condition
Searching for Files Not on Disk
Searching for files that are not on disk is more complex because devices other than
disks can have subdevices with device types that are different from their parent device.
In addition, a process that simulates a device type may have process qualifiers
representing various device types. Note that neither of these restrictions apply to disk
files; disk files and subvolumes always have the same device type as their parent
volume, and, moreover, a process cannot simulate a disk device.
The implication of this is that you do not significantly reduce the search time by
restricting a search to a device type other than disk (although the list of matching files
may be shortened).
You can, however, eliminate the problem of processes that simulate devices by
avoiding searching for them. To do so, you need to set the no-device-simulation
flag (bit 10) in the options parameter to 1. These processes will then be regarded as
subtype 30 processes rather than the device type of the devices they simulate.