List and Data Registers [ HP Transact Reference Manual ] MPE/iX 5.0 Documentation
HP Transact Reference Manual
List and Data Registers
The list and data registers are used to allocate data storage space for
data items manipulated by the program. The data register has a default
size of 1024 words, and it is the actual storage area for the values of
data items. By itself, however, this register does not differentiate
between the end of one item and the beginning of another. In order for
the Transact program to do this, the values in the data register must be
mapped by the identifiers in the list register. Before a program can
manipulate a data item, it must be "listed," or placed in the list
register by including a LIST statement in the program. For every data
item that you name in the LIST statement, Transact includes an identifier
in the list register. Transact uses this identifier to locate the
correct value in the data register.
The order in which the data item identifiers are listed in the list
register determines the order of the corresponding data item values in
the data register. Data item identifiers in the list register and the
corresponding space in the data register, are allocated in the order that
the data item names are specified in the LIST statement. For example, if
the first data item identifier added to the list register is for a data
item called NAME, a 6-byte character string, the first 6 bytes of the
data register are allocated to hold the value of NAME. If the second item
identifier in the list register is for a data item called ADDRESS that
identifies a 20-byte character string, the next 20 bytes of storage space
in the data register are reserved for the value of ADDRESS.
Data item identifiers and item values are added to the list register and
data register starting at the bottom and extending toward the top. The
same data item can be added to the list register and data register more
than once in a single program. When this is done, only the most recent
addition of the data item is accessible by the program.
In many ways these registers behave like stacks, and it is helpful to
think of them as such.
Managing the List and Data Registers
When program execution begins, the list register is empty and the
contents of the data register are undefined. When the list register is
empty, you cannot access the data register. During the course of program
execution, you add data item names to the list register, thereby defining
the data item space. Every data item added to the list register must
have been previously defined either in a DEFINE(ITEM) statement or in the
data dictionary. Note that child item names can not be added to the list
register, only the parent item names.
Allocating space in the data register does not move the data into the
register. Transact provides a way to transfer data to the data register
either interactively from a terminal through prompts or a VPLUS form, or
programmatically from files, data sets, or through assignment statements.
To minimize your data storage requirements, you should release the data
register space occupied by your data items when you are finished using
them. Transact can do this for you. If you are using a command
structure, Transact resets the list register whenever a command sequence
executes. If you are not using a command structure, you should manage
your data storage directly with Transact statements.
When data items are removed from the list register, they are removed from
top to bottom; that is, the last data item added is the first data item
removed. The values, however, corresponding to the data items removed
from the list register, still exist in the data register. You can access
these values again by listing the data item again in the list register.
It is possible also to relist different data items in the list register
and redefine the values in the data register.
When a data item is listed multiple times, the last occurrence of the
data item in the data register is the one that is used. To access a
previous occurrence of the data item, you must remove the current
occurrence from the list register via the SET(STACK) verb.
MPE/iX 5.0 Documentation