pTAL Reference Manual (G06.24+, H06.09+, J06.03+)

Table 15 Identifier Classes (continued)
DescriptionClass
Template structureTemplate
* Available only on Guardian platforms.
Variables
A variable is a symbolic representation of data. It can be a single-element variable or a
multiple-element variable. You use variables to store data that can change during program execution.
Before you can access data stored in a variable you must either:
Initialize the variable with a value when you declare the variable
Assign a value to the variable after you declare the variable
Table 16 Variable Types
DescriptionVariable Type
A variable that contains one element of a specified data typeSimple variable
A variable that contains multiple elements of the same data typeArray
A variable that can contain variables of different data typesStructure
A structure nested within a structure or substructureSubstructure
A simple variable, array, simple pointer, substructure, or structure pointer declared
in a structure or substructure; also known as a structure field
Structure item
A variable that contains a memory address, usually of a simple variable or an array
element, which you can access with this nonstructure pointer
Nonstructure pointer
A variable that contains the memory address of a structure, which you can access
with this structure pointer
Structure pointer
Scope
Every declared item in a pTAL program has a scope that determines where in the program it is
visible (after the point of declaration).
Visible ...Declared in a ...Scope
Everywhere in the programProgramGlobal
Only in the procedure that declares it (including the
subprocedures of that procedure)
ProcedureLocal
Only in the subprocedure that declares itSubprocedureSublocal
Formal parameters of procedures and subprocedures have local and sublocal scope, respectively.
Example 3 Scope of Declared Items
int i; ! i has global scope and is visible everywhere
! from this point forward.
proc p; ! p has global scope. If p had formal
! parameters, they would have local scope.
begin
int j := i; ! j has local scope and is visible everywhere in
! procedure p from this point forward.
subproc s; ! s has local scope. If s had formal parameters,
! they would have sublocal scope.
begin
Declarations 43