pTAL Reference Manual (G06.24+, H06.09+, J06.03+)
lower-bound
is an INT or INT(32) constant expression (in the range -32,768 through 32,767) that
specifies the index (relative to the zeroth element) of the first array element you want
allocated. The default value is 0.
upper-bound
is an INT or INT(32) constant expression (in the range -32,768 through 32,767) that
specifies the index (relative to the zeroth element) of the last array element you want
allocated. The default value is the number of elements initialized minus one.
'p'
specifies a read-only array.
initialization
is a constant list to assign to the array elements. You must initialize read-only arrays when you
declare them. (Constant lists are described in Chapter 3 (page 46).)
Specify initialization values that are appropriate for the data type of the array. For example,
if the decimal setting of an initialization value differs from the fpoint of a FIXED array, the
system scales the initialization value to match the fpoint. If the initialization value is scaled
down, some precision is lost.
The compiler reports a warning if a read-only array declaration specifies an indirection symbol
(see Table 14 (page 41)).
Example 48 Read-Only Array Declaration With Indirection Symbol
PROC p;
BEGIN
INT i = 'P' := [2,3,4]; ! OK
INT .j = 'P' := [5,6,7]; ! Compiler reports a warning
STRING k = 'P' := ["abc"]; ! OK
STRING .l = 'P' := ["ccc"]; ! Compiler reports a warning
END;
You must initialize read-only arrays.
UNSIGNED read-only arrays are not allowed, because they cannot be initialized.
If you declare a read-only array in a RESIDENT procedure, the array is also resident in main
memory.
The linker links each global read-only array into any code segment containing a procedure that
references the array.
You can access read-only arrays as you access any other array, except that:
• You cannot modify a read-only array; that is, you cannot specify a read-only array on the left
side of an assignment or move operator.
• You cannot specify a read-only array on the left side of a group comparison expression.
• In a SCAN or RSCAN statement, you cannot use next-addr to read the last character of
a string. You can use next-addr to compute the length of the string.
112 Arrays