Pathmaker Reference Manual

Macro Language Components
Macro Language
3–2 067869 Tandem Computers Incorporated
Variables Pathmaker macros use variables for text substitution and to control the flow of
processing. The name and contents of a variable are set in the command lines of a
macro, unless you are using constructs preset by Tandem. Variables can be expanded
in source or command lines.
Variable Syntax
Variable names can consist of 1 to 30 alphanumeric characters and can include
hyphens (-). A variable name cannot end in a hyphen, however.
The first character of a variable name determines the class of the variable. The macro
language provides for three classes of variables: local, global, and construct variables.
These classes are explained in the following paragraphs. Examples of variables are
given with the syntax of the SET command later in this section.
Local Variables. Local variables start with an alphabetic character—a letter—and are
defined with the SET command. Local variables are valid while the macro in which
they are defined is processing. When a macro has completed, its local variables are no
longer in effect. If a macro invokes another macro, local variables set for the invoking
macro are valid for the invoked macro. When the invoked macro completes, however,
local variable values set by the invoked macro are discarded.
Global Variables. Global variables start with a colon (:) and are defined with the SET
command. Global variable values persist after the macro in which they are invoked
completes. If a macro containing a global variable invokes another macro that resets
the global variable as a local variable, the global value is reinstated when the invoked
macro completes.
Construct Variables. Construct variables start with a pound sign (#) and are predefined
by Tandem for use in both requester and server contexts. These variables provide a
way to access data in the Pathmaker catalog. Construct variables and rules for their
use are described in Appendix C. Note that the macro language ITERATE and EMIT
commands, described in this section, are designed to work only with constructs.
Referencing Variables
Local and global variables are referenced in macro source lines, using the following
syntax:
$
variable
[ {SIZE }
digits
]$
{MAX }
SIZE
specifies that when substitution for variables occurs, the variable text will be
truncated or blank padded so that it is exactly the number of characters given in
digits
. If no SIZE is given, variable substitution will be for the natural length of
the variable.