TACL Reference Manual
Variables
HP NonStop TACL Reference Manual—429513-018
4-26
Accessing Structured Data
•
If you are storing data in a substructure or array (except of type CHAR) you must
enter it into a space-separated list of representations appropriate for the types of
those items. If the data is shorter than the substructure or array, TACL sets
remaining numeric binary items to binary zero and sets other types of items to
spaces.
•
Data that is being stored into an array of type CHAR is not separated by spaces
and may even include spaces. If the data is exhausted, TACL sets the remainder
of the array to spaces.
These examples are based on this structure:
[#DEF tacl^files STRUCT
BEGIN
STRUCT file (1:3);
BEGIN
FNAME name;
UINT code;
END;
END;
]
Use the #SET built-in function to specify values:
#SET tacl^files:file(2):name taclbase == set a data item
#SET tacl^files:file(1) tacl 100 == set substructure values
== set structure values
#SET tacl^files tacl 100 taclbase 101 taclinit 101
== set structure values from variables
#SET tacl^files [prg] [prgcd] [lib] [libcd] [mac] [maccd]
Accessing Structured Data
To display structured data in a stylized format, use #OUTPUTV. To invoke the
STRUCT (expand its contents into a space-separated list), surround the STRUCT
name with square brackets.
To access a data item in a structure, specify the fully qualified identifier of the structure
item, using this form, with or without array indexes:
struct-name [ :substruct-name ... ] :item-name
A structure identifier cannot contain any spaces.
All indexes must be within the range declared for the data item. If you try to use an
index outside the range declared for a data item, TACL returns an error.
An example of an identifier of a structure item is:
record.-1:table(1):item([x])
where .-1 indicates that you are accessing the next-to-the-top level of the variable
record; x is a numeric variable containing a valid index.