pTAL Reference Manual (G06.24+, H06.09+, J06.03+)
Table 72 $OCCURS for Structure Arrays and Arrays Within Structures (continued)
$OCCURS ReturnsExample$OCCURS Argument
$OCCURS (a[7].t[3].i);
$OCCURS (a[7].t[3].i[v]);
5
1
STRUCT s;
BEGIN
Entire structure
or
INT f;
END;
nonarray field of a structure or
substructure
1
1
$OCCURS (s);
$OCCURS (s.f);
STRUCT s;
BEGIN
Structure template
INT f[0:9];
END;
Compile-time err
10
1
$OCCURS (s);
$OCCURS (s.f);
$OCCURS (s.f[5]);
Example 283 $OCCURS Routine With Nonstructure Arrays
PROC p(x, y);
INT x,
.y;
BEGIN
INT a[0:9];
INT i;
INT .r;
i := $OCCURS(a); ! OK: a is an entire array
i := $OCCURS(i); ! OK: $OCCURS returns 1
i := $OCCURS(x); ! OK: $OCCURS returns 1
i := $OCCURS(a[3]); ! WARNING: $OCCURS returns 1
i := $OCCURS(a[i]); ! WARNING: $OCCURS returns 1
i := $OCCURS(r); ! WARNING: $OCCURS returns 1
i := $OCCURS(y); ! WARNING: $OCCURS returns 1
END;
Example 284 $OCCURS Routine With Structure Arrays
INT i;
STRUCT s[0:9];
BEGIN
STRUCT t[0:7];
BEGIN
INT i[0:4];
INT f;
END;
END;
i := $OCCURS(s); ! OK: s is an entire array
i := $OCCURS(s[7].t); ! OK: t is an entire array
i := $OCCURS(s[7].t[3].i); ! OK: i is an entire array
i := $OCCURS(s[7].t[3].f); ! OK: $OCCURS returns 1
i := $OCCURS(s[7]); ! WARNING: $OCCURS returns 1
i := $OCCURS(s[7].t[3]); ! WARNING: $OCCURS returns 1
i := $OCCURS(s[7].t[3].i[v]); ! WARNING: $OCCURS returns 1
Nonatomic Operations 331