|
|
System Debug provides variables in which values may be stored
for use as operands in expressions. Variable names must begin with
an alphabetic character, which may be followed by any combination
of alphanumeric, apostrophe ('), underscore (_),
or dollar sign ($) characters. Variable names are case insensitive
and may not exceed 32 characters.
System Debug supports two levels of variable scoping: global
and local. Global variables are defined by the VAR
command and exist for the lifetime of the System
Debug session (unless removed by the VARD command):
$nmdebug > var v1 $2f
$nmdebug > var s2 = "hello mom"
$nmdebug > var p3:lptr = 2f.102c
The type of a variable is determined by the type of the expression
which computes its value. The optional :type
syntax which follows the variable name imposes a
check on the expression type for that particular assignment only.
It does not establish the variable's type over its entire lifetime.
A value of a different type may be assigned to the same variable
by a subsequent VAR command.
Local variables are defined by the LOC command only from within macro
bodies and exist only for the lifetime of the macro in which they are defined.
Local variable definitions nest with macro execution level, and they supercede
global variables of the same name. Note that local variables normally
are not visible from outside the macro in which they are created
(that is, from macros called by the one in which they are created).
To make local variable visible to called macros, the environment
variable NONLOCALVARS must be TRUE.
loc v1 200
loc s2 = "new string"
Note that, although a macro cannot reference the value of a global variable
once a local variable of the same name has been defined, it may change the
global value by using the VAR command instead of LOC.
!variable
The use of the letters a through f to denote hex digits
implies the possibility of ambiguity between hex constants and variable names
composed of just these characters. System Debug warns the user of this
occurrence when such variables are defined by the VAR and LOC
commands, but uses the value of the constant when the name occurs in an
expression. This may be overridden by preceding the variable name with the
exclamation point as follows:
$nmdebug > var a 123
Variable name collides with hex numeric literal. (warning #55)
Name: "a"
$nmdebug > wl a+1 /* a is a hex constant here
$b
$nmdebug > wl !a+1 /* !a references the variable a
$124
$nmdebug >
|