pTAL Reference Manual (H06.03+)

Built-In Routines
HP pTAL Reference Manual523746-005
15-69
$OCCURS
$OCCURS
$OCCURS returns an INT value that is the number of elements in an array.
variable
is the name of a variable, array, structure, or structure field. variable cannot be
the name of a structure template.
If identifier is the identifier of an explicitly declared array—that is, it is not a
reference parameter—and identifier is the unindexed name of the array, $OCCURS
returns the number of array elements specified in the array’s declaration; otherwise,
$OCCURS returns 1.
pTAL privileged procedure No
Can be executed only by privileged procedures No
Sets condition code No
Sets $CARRY No
Sets $OVERFLOW No
Table 15-14. $OCCURS for Nonstructure Arrays
$OCCURS Argument Example $OCCURS Returns
Entire array INT a[0:9];
$OCCURS (a);
10
Value parameter or simple variable INT a;
$OCCURS (a);
1
Reference parameter or pointer INT .a;
$OCCURS (a);
1
Array element using constant index INT a[0:9];
$OCCURS (a[3]);
1
Array element using expression in index INT a[0:9];
$OCCURS (a[j]);
1
( )$OCCURS
VST103.vsd
variable