Guardian Programmer's Guide

Table Of Contents
Manipulating File Names
Guardian Programmer’s Guide 421922-014
13 - 41
Manipulating File Names: An Example
! If it is a pattern:
1 -> BEGIN
! Resolve pattern to fully qualified form:
ERROR := FILENAME_RESOLVE_(
CI^STARTUP.PARAM[0]:COUNT,
PATTERN:MAXPATTERN,
FULL^LENGTH);
IF ERROR <> 0 THEN CALL FILE^ERRORS(ERROR)
! Call FIND^FILES to search for and print all file
! names that match this pattern:
ELSE CALL FIND^FILES(PATTERN,FULL^LENGTH);
END;
! If it is a DEFINE:
2 -> BEGIN
! Accept only a map DEFINE, reject all others with
! error:
OPTIONS := DEFINE^SIMPLE^RESOLVE LOR DEFINE^REJECT;
! Resolve to fully qualified form of file named by
! map DEFINE:
ERROR := FILENAME_RESOLVE_(
CI^STARTUP.PARAM[0]:COUNT,
FULLNAME:MAXLEN,
FULL^LENGTH,
OPTIONS);
IF ERROR <> 0 THEN CALL FILE^ERRORS(ERROR)
! Call PRINT^NAME to print the file name:
ELSE CALL PRINT^NAME(FULLNAME,FULL^LENGTH);
END;
END;
END;