Guardian Programmer's Guide

Table Of Contents
Using DEFINEs
Guardian Programmer’s Guide 421922-014
7 - 11
Referring to DEFINEs
By default, DEFINE mode is turned on, so it is normally not necessary to enable
DEFINE mode. If DEFINE mode is not enabled, however, you can turn it on as
described below.
You enable DEFINE mode for the current process by calling the DEFINEMODE
procedure with the first parameter set to 1 as follows:
NEW^VALUE := 1;
ERROR := DEFINEMODE(NEW^VALUE,
OLD^VALUE);
IF ERROR <> 0 THEN ...
The previous setting of the DEFINE mode is returned in OLD^VALUE: 0 indicates
DEFINE mode was turned off, and 1 indicates DEFINE mode was turned on. The
procedure returns error 2067 if the supplied new value is illegal.
To disable DEFINE mode again, simply call the DEFINEMODE procedure again but
with NEW^VALUE set to 0:
NEW^VALUE := 0;
CALL DEFINEMODE(NEW^VALUE,
OLD^VALUE);
You can also enable or disable DEFINE mode in a process your program is creating by
use of the create-options parameter of the PROCESS_CREATE_ procedure.
Section 16, Creating and Managing Processes, provides details.
Referring to DEFINEs
Assuming DEFINE mode is already on, you simply refer to a DEFINE by name in order
to use it.
Adding DEFINEs
This subsection discusses the system procedures that permit you to enable DEFINEs
and add DEFINEs to the context of the current process. Assuming DEFINE mode is
already on, you perform the following steps when processing DEFINEs:
1. Set the attributes of a new DEFINE in the working set of your process and check
the working set for errors
2. Add/replace the DEFINE in the context of your process
These operations are described in the following paragraphs, as well as how to delete a
DEFINE from the process context and how to save and restore DEFINEs.
Note. DEFINE mode, like DEFINEs themselves, is propagated from the parent process. If
DEFINE mode is turned on in the creator process, then it is also turned on in the child process,
unless the parent process specifically requested something else. If DEFINE mode is turned off
in the parent process, then, by default, it is also turned off in the child process. Therefore, if
DEFINE mode is turned off for your process, you should find out why before proceeding. The
process that turned it off might have had a specific reason to do so.