TACL Reference Manual

Variables
HP NonStop TACL Reference Manual429513-018
4-19
Declaring a Substructure
For CHAR items, initial-value is the same as that defined for a simple data item (in
the previous subsection). If you include VALUE but supply an incorrect number of
initial values, TACL returns a syntax error.
For all other items, initial-value is a space-separated list of values appropriate to
the type of the item. End-of-line may also be used as a separator. The list ends
when the semicolon is reached. If initial-value does not supply enough data for all
occurrences of the item, TACL supplies appropriate default initial values for the
remaining occurrences.
Consideration
TACL treats a data item declared without bounds as though it had been declared with
bounds (0:0, which is one byte long).
Example
This example declares a structure containing various arrays:
[#DEF arrays STRUCT
BEGIN
INT array^1 (1:100);
INT array^2 (-5:-1) VALUE 1 2 3 4 5;
INT array^3 (-90:90);
CHAR array^4 (0:16) VALUE "This is a ""VALUE""";
END;
]
Declaring a Substructure
A substructure declaration associates an identifier with a structure embedded within
another structure or substructure. The syntax for a substructure declaration is:
STRUCT identifier [ ( lower-bound : upper-bound ) ] ;
structure-body
identifier
is a name, 1 to 32 characters in length, which can include alphanumeric,
underscore, and circumflex characters; the first character cannot be numeric.
lower-bound
is a value in the range -32768 to +32767 that defines the number of the first
array element of an array data item; it must be less than or equal to upper-
bound.
upper-bound
is a value in the range -32768 to +32767 that defines the number of the last array
element of an array data item; it must be greater than or equal to lower-bound.