TAL Reference Manual
Standard Functions
TAL Reference Manual—526371-001
14-29
$OCCURS Function
$OCCURS Function
The $OCCURS function returns the number of occurrences of a variable.
variable
is the identifier of:
•
An array, structure, or substructure (but not a template structure)
•
An array declared in a structure
Usage Considerations
$OCCURS returns the number of:
•
Elements in an array
•
Occurrences of a structure or substructure
For example, if the argument is declared with the bounds [0:3], $OCCURS returns the 
value 4.
You can use $OCCURS to find the total length of an entire array or substructure:
•
To find the length in bytes, multiply the values returned by $LEN and $OCCURS.
•
To find the length in bits, multiply the values returned by $BITLENGTH and 
$OCCURS.
You can find the length of a structure in the same way, except that you must first round 
up the length value to the word boundary before multiplying the rounded value with the 
$OCCURS value.
If 
variable is a template structure, the compiler returns error 69 (invalid template 
access).
If 
variable is a simple variable, pointer, or procedure parameter, the compiler returns 
warning 43 (a default $OCCURS count of 1 is returned).
You can use $OCCURS in LITERAL expressions and global initializations, because it 
always returns a constant value.
$OCCURS
(
variable
)
VST1432.vsd










