Guardian Programmer's Guide

Table Of Contents
Using DEFINEs
Guardian Programmer’s Guide 421922-014
7 - 15
Deleting DEFINEs From the Process Context
ERROR := DEFINEADD(DEFINE^NAME,REPLACE,CHECK^NUM);
CASE ERROR OF
BEGIN
.
.
Deleting DEFINEs From the Process Context
You can delete DEFINEs from the context of a process using the DEFINEDELETE or
DEFINEDELETEALL procedure. The DEFINEDELETE procedure deletes a specific
DEFINE, for example:
DEFINE^NAME ':=' "=TAPE1 ";
ERROR := DEFINEDELETE(DEFINE^NAME);
IF ERROR <> 0 THEN ...
The DEFINEDELETEALL procedure deletes all DEFINEs from the context of the
current process except the =_DEFAULTS DEFINE. (You cannot delete the
=_DEFAULTS DEFINE.)
CALL DEFINEDELETEALL;
Saving and Restoring DEFINEs
Sometimes it can be useful to maintain several independent contexts for starting new
processes. The DEFINESAVE and DEFINERESTORE procedures provide a way to
save a DEFINE or a working set of attributes in a memory buffer and then restore the
contents of that buffer into a new DEFINE or working set.
You save a DEFINE in a buffer using the DEFINESAVE procedure:
BUFF^LEN := 500;
DEFINE^NAME ':=' "=TAPE1 ";
ERROR := DEFINESAVE(DEFINE^NAME,
TAPE^BUFFER,
BUFF^LEN,
DEFINE^LEN);
IF ERROR <> 0 THEN ...
The above example saves the =TAPE1 DEFINE in a 500-byte buffer named
TAPE^BUFFER. The actual length of the DEFINE is returned in DEFINE^LEN. The
final parameter is set to 0 to tell the system to save the DEFINE named in the first
parameter. When DEFINESAVE saves a DEFINE in a user buffer, the DEFINE is
saved in another format. You should not attempt to modify this format, otherwise
DEFINERESTORE may not be able to restore the DEFINE.
You restore a DEFINE using the DEFINERESTORE procedure. The
DEFINERESTORE procedure can add a DEFINE to the process context or change the
attributes of an existing DEFINE. However, you must specify whether you intend to
add or alter the DEFINE.