TAL Programmer's Guide

Accessing Structure Items
Using Structures
096254 Tandem Computers Incorporated 8–31
To access a structure item whose offset is outside the signed INT range (–32678
through 32,767), you must use an INT(32) index. To convert an INT index to an
INT(32) index, you can use the $DBL standard function:
STRUCT .EXT xstruct[0:9999];
BEGIN
STRING array[0:9]; !Upper byte offset > 32,767;
END; ! INT(32) index required
INT index;
PROC my_proc MAIN;
BEGIN
!Some code here to initialize INDEX
xstruct[$DBL(index)].array[0] := 1;
!Generate correct offset
END; ! because INDEX is an INT(32)
! expression
In the preceding example, the upper-byte offset of ARRAY is larger than 32,767,
computed as follows:
9999 * 10 + 9 = 99999
Upper bound of array
Size of structure in bytes
Upper bound of structure
Size of offset to ARRAY[9]
334