pTAL Reference Manual (G06.24+, H06.09+, J06.03+)
Example 282 $NUMERIC Routine
STRING char;
IF $NUMERIC (char) THEN ... ; ! Test for numeric character
$OCCURS
$OCCURS returns an INT value that is the number of elements in an array.
NopTAL privileged procedure
NoCan be executed only by privileged procedures
NoSets condition code
NoSets $CARRY
NoSets $OVERFLOW
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.
Table 71 $OCCURS for Nonstructure Arrays
$OCCURS ReturnsExample$OCCURS Argument
10
INT a[0:9];
$OCCURS (a);
Entire array
1
INT a;
$OCCURS (a);
Value parameter or simple variable
1
INT .a;
$OCCURS (a);
Reference parameter or pointer
1
INT a[0:9];
$OCCURS (a[3]);
Array element using constant index
1
INT a[0:9];
$OCCURS (a[j]);
Array element using expression in index
Table 72 $OCCURS for Structure Arrays and Arrays Within Structures
$OCCURS ReturnsExample$OCCURS Argument
STRUCT s [0:9];
BEGIN
Unindexed structure array or
substructure array
STRUCT
or
BEGIN
an element of a structure array or
substructure array,
INT
END;
END;
or
10
1
$OCCURS (s);
$OCCURS (a[7]);
an array that is a field within a
structure or substructure
8$OCCURS (a[7].t);
1$OCCURS (a[7].t[3]);
330 Built-In Routines