pTAL Reference Manual (H06.03+)

Built-In Routines
HP pTAL Reference Manual523746-005
15-71
$OFFSET
$OFFSET
$OFFSET returns an INT value that is the offset, in bytes, of a structure item from the
beginning of the structure
.
Example 15-63. $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
Example 15-64. $OCCURS Routine With Template Structure Arrays
INT i;
STRUCT s(*);
BEGIN
INT f[0:9];
END;
i := $OCCURS(s); ! ERROR: Template structure not OK
i := $OCCURS(s.f); ! OK: f is an array
i := $OCCURS(s.f[5]); ! WARNING: $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
( )$OFFSET
VST104.vsd
variable