Guardian Programmer's Guide

Table Of Contents
Using DEFINEs
Guardian Programmer’s Guide 421922-014
7 - 16
Saving and Restoring the Working Set
LITERAL ADD^DEFINE = 0,
CHG^DEFINE = 1;
.
.
DEFINE^NAME ':=' "=TAPE1 ";
ERROR := DEFINERESTORE(TAPE^BUFFER,
ADD^DEFINE,
DEFINE^NAME,
CHECK^NUM);
IF ERROR = 2058 THEN ...
ELSE IF ERROR <> 0 THEN ...
DEFINE^NAME ':=' "=TAPE2 ";
ERROR := DEFINERESTORE(TAPE^BUFFER2,
CHG^DEFINE,
DEFINE^NAME,
CHECK^NUM);
IF ERROR = 2058 THEN ...
ELSE IF ERROR <> 0 THEN ...
The first of the two calls shown above adds the DEFINE to the context of the current
process. You specify that the DEFINE is to be added by setting the second parameter
to 0. If a DEFINE of the name =TAPE1 already exists, then the system returns an
error.
The second call above changes the value of an existing DEFINE. Here, the second
parameter is set to 1. If the =TAPE2 DEFINE does not already exist in the context of
the current process, then the system returns an error.
In addition to returning a standard error number, if the system detects that the saved
DEFINE (or saved working set) is inconsistent, then an additional error value is
returned in CHECK^NUM to give more information about the error.
Saving and Restoring the Working Set
You can save the working set of attributes in the background and have the option to
restore the saved working set later. There are three areas where sets of attributes can
be held outside of DEFINEs. The three places are the working set and two
background areas.
The DEFINESAVEWORK and DEFINERESTOREWORK procedures move sets of
attributes between the working set and one background area.
The DEFINESAVEWORK2 and DEFINERESTOREWORK2 procedures move sets
of attributes between the working set and the other background area.
You cannot use DEFINERESTOREWORK2 to restore a working set saved by
DEFINESAVEWORK, nor can you use DEFINERESTOREWORK to restore a working
set saved by DEFINESAVEWORK2.