Guardian Programmer's Guide

Table Of Contents
Using DEFINEs
Guardian Programmer’s Guide 421922-014
7 - 13
Checking the Working Set for Errors
When you have assigned a value to an attribute, the system verifies that the value you
specified matches the data type of the attribute. The procedure returns an error if the
value does not match the data type.
Setting Attributes Using the DEFINESETLIKE Procedure
For any DEFINE that already exists in the context of the current process, you can
initialize the attributes of the working set to the values of the attributes of that DEFINE.
You do this using the DEFINESETLIKE procedure:
DEFINE^NAME ':=' "=TAPE1 ";
ERROR := DEFINESETLIKE(DEFINE^NAME);
IF ERROR <> 0 THEN ...
After initializing the working set attributes using this procedure, you can call
DEFINESETATTR to alter the values of specific attributes.
Setting Attributes Using the DEFINERESTORE Procedure
If you have saved a working set or a DEFINE using the DEFINESAVE procedure (see
Saving and Restoring DEFINEs, later in this section), you can initialize the attributes of
the working set by restoring that DEFINE or saved working set using the
DEFINERESTORE procedure:
LITERAL RESTORE^SAVED = 2;
.
.
ERROR := DEFINERESTORE(BUFFER,
RESTORE^SAVED);
Setting the second parameter to 2 forces the saved DEFINE to be restored as the
working set.
Checking the Working Set for Errors
After assigning values to the attributes in the working set, you can check the attribute
values for errors using the DEFINEVALIDATEWORK procedure. This procedure
indicates whether the attributes in the working set are incomplete, inconsistent, or
invalid.
ERROR := DEFINEVALIDATEWORK(CHECK^NUM);
CASE ERROR OF
BEGIN
0 -> !no error
2057 -> !incomplete
2058 -> !inconsistent
2059 -> !invalid
OTHERWISE -> !some other problem
END;
Here, the program checks whether the ERROR value returned is 2057, 2058, or 2059.