pTAL Conversion Guide

Equivalenced Variables
pTAL Conversion Guide527302-002
12-2
Terminology
Direct equivalenced variable
A direct equivalenced variable is a simple variable, direct array, direct structure,
standard pointer (including a standard structure pointer), or extended pointer
(including an extended structure pointer). Direct items can be equivalenced only to
other direct items (with two exceptions noted later in this topic).
Indirect equivalenced variable
An indirect equivalenced variable is a standard indirect array or standard indirect
structure. Standard indirect items can be equivalenced only to other standard
indirect items.
Extended equivalenced variable
An extended equivalenced variable is an extended indirect array or extended
indirect structure. Extended indirect items can be equivalenced only to other
extended indirect items.
Equivalenced standard pointer
The equivalenced variable is a pointer to data in the user data segment.
Equivalenced extended pointer
The equivalenced variable is a pointer to data in an extended memory segment.
Indirect cell (also called an implicit pointer)
An indirect cell (also called an implicit pointer) is a 16-bit word or 32-bit doubleword
that contains the address of data.
The TAL compiler allocates this word or doubleword when you declare an indirect
array or indirect structure, and stores in it the address of the array or structure
data. For example, for the following declaration, TAL allocates four words of
storage for the four elements of the array a, and also allocates a one-word pointer
to a:
INT .a[0:3];
The native compiler allocates storage for the four elements of the array a, but not
for a pointer to a. References to a access the data directly, not indirectly through a
pointer.
If an equivalenced variable is a standard or extended pointer and the previous
variable is the implicit pointer of an indirect array or indirect structure, the
equivalenced variable is a read-only pointer. You can use the value of the pointer in
an expression, but you cannot store an address or other value into the pointer
because doing so would be the same as storing an address into the implicit pointer
of the array or structure.
You can, however, use a pointer to read or write the data to which the pointer
points.