TACL Reference Manual

Variables
HP NonStop TACL Reference Manual429513-018
4-3
Variable Levels
list of necessary directories depends on the TACL software RVU and must not be
hard coded in your TACL programs.
Variable Levels
A variable level is an important organizational concept associated with TACL variables.
Whenever you create a variable, TACL creates a stack for the variable. Each element
of the stack is known as a variable level. The stack organization allows you to create
local copies of a variable. You can delete the local copies when you exit the local
environment, restoring the variable to its original value.
When you add a new variable level, TACL pushes the stack down by one level; when
you remove a level, TACL pops the stack by one level.
This diagram illustrates a sample variable, var1, that contains three levels:
Declaring a Variable
Table 4-2 lists TACL functions that allocate and define variables.
In addition, the ?SECTION directive allows you to declare any type of TACL variable.
To access such variables, you must LOAD the file that contains them.
Note. Descriptions in this manual sometimes use the term “variable” to mean “variable level,”
for brevity.
Variable Name and Level Contents
var1.3 (top), also accessible as var1 XYZ
var1.2 A
var1.1 35
Table 4-2. Functions and Commands That Allocate and Define Variables
Command
(Interactive)
Function
(Programmatic) Description
PUSH #PUSH Adds a level to the top of a variable. If the variable does
not exist, PUSH and #PUSH reserve the name; when
you use SET VARIABLE or #SET to assign a value to
the variable, TACL reserves space for the variable.
- #DEF Adds a level to the top of a variable. If the variable does
not exist, TACL creates it. You can use #DEF to assign
initial values to the variable. To create a STRUCT
variable, you must use #DEF.
SET
VARIABLE
#SET, #SETV,
#SETMANY
Assigns a value to a variable. If this is a new variable,
this step actually creates the variable.