Guardian Programmer's Guide

Table Of Contents
Manipulating File Names
Guardian Programmer’s Guide 421922-014
13 - 35
Manipulating File Names: An Example
The FIND^FILES procedure searches for all file names that match a given pattern.
It calls PRINT^NAME for each match that it finds.
The FILE^ERRORS procedure reports file-system errors by sending the error
number to the output file.
The TAL source code for this program follows.
? INSPECT, SYMBOLS, NOCODE, NOMAP
?NOLIST, SOURCE $TOOLS.ZTOOLD00.ZSYSTAL
?LIST
-------------------------------------------------------------
!Global parameters
-------------------------------------------------------------
LITERAL ACCEPT^PATTERNS =
%B0000000000000001; !for FILENAME_SCAN_
LITERAL DEFINE^SIMPLE^RESOLVE =
%B0000000000001000; !for FILENAME_RESOLVE_
LITERAL DEFINE^REJECT =
%B0000000000100000; !for FILENAME_RESOLVE_
LITERAL MAXLEN =
ZSYS^VAL^LEN^FILENAME; !maximum file-name length
LITERAL MAXPATTERN = 512; !maximum pattern length
INT ERROR; !error return
INT OUTNUM; !OUT file number
INT INNUM; !IN file number
STRING .S^PTR; !pointer to end of string
STRUCT .CI^STARTUP; !Startup message
BEGIN
INT MSGCODE;
STRUCT DEFAULTS;
BEGIN
INT VOLUME[0:3];
INT SUBVOL[0:3];
END;
STRUCT INFILE;
BEGIN
INT VOLUME[0:3];
INT SUBVOL[0:3];
INT FILEID[0:3];
END;
STRUCT OUTFILE;
BEGIN
INT VOLUME[0:3];
INT SUBVOL[0:3];
INT FILEID[0:3];
END;
STRING PARAM[0:529];
END;