Guardian Programmer's Guide

Table Of Contents
Using DEFINEs
Guardian Programmer’s Guide 421922-014
7 - 3
Example of a CLASS MAP DEFINE
SUBVOL20
RELSUBVOL20
The name of the DEFINE can then be used in a call to the FILENAME_RESOLVE_
procedure to provide a search list for a program file you want to execute, or it can be
used to provide a search list for locating component source files when compiling a
program.
If any attribute is a list, the search order is from left to right within the list.
CLASS TAPE DEFINEs contain attribute information for use with labeled magnetic
tapes. One CLASS TAPE DEFINE must be used for each labeled-tape file that is
accessed by your application. CLASS TAPE DEFINEs are processed by the tape
process and by the file-system FILE_OPEN_ procedure. The attribute parameters of
a CLASS TAPE DEFINE specify parameters such as block size and density.
CLASS DEFAULTS DEFINEs are used to pass default system, volume, subvolume,
and swap information to a process. (For TNS/R native processes, the swap
information is ignored.)
The following paragraphs provide examples of each of these classes of DEFINEs.
Example of a CLASS MAP DEFINE
The following example sets up a DEFINE named =MYFILE with the file name
\SYS1.$OURVOL.MYSUBVOL.DIARY. The code uses procedures DEFINESETATTR
and DEFINEADD. The file is later accessed using the DEFINE name:
ATTRIBUTE^NAME ':=' "CLASS ";
ATTRIBUTE^VALUE ':=' "MAP";
ATTRIBUTE^LENGTH := 3;
ERROR := DEFINESETATTR(ATTRIBUTE^NAME,
ATTRIBUTE^VALUE,
ATTRIBUTE^LENGTH,
DEFAULT^NAMES);
IF ERROR <> 0 THEN ...
ATTRIBUTE^NAME ':=' "FILE ";
ATTRIBUTE^VALUE ':=' "\SYS1.$OURVOL.MYSUBVOL.DIARY";
ATTRIBUTE^LENGTH := 28;
ERROR := DEFINESETATTR(ATTRIBUTE^NAME,
ATTRIBUTE^VALUE,
ATTRIBUTE^LENGTH,
DEFAULT^NAMES);
IF ERROR <> 0 THEN ...
DEFINE^NAME ':=' "=MYFILE ";
LENGTH := 7;
ERROR := DEFINEADD(DEFINE^NAME);
IF ERROR <> 0 THEN ...
.
.
.
ERROR := FILE_OPEN_(DEFINE^NAME:LENGTH,