Where PL/I requires a (possibly signed) constant, a restricted expression can be used.
A named constant must be declared before it is used. A reference to an element of a one-dimensional STATIC NONASGN array with the INITIAL attribute will also be treated as a named constant if the subscript is a FIXED DEC(p,0) value with p <= 3 and if the array elements are numeric.
dcl Max_names fixed bin value (1000),
Name_size fixed bin value (30),
Addr_size fixed bin value (20),
Addr_lines fixed bin value (4);
dcl 1 Name_addr(Max_names),
2 Name char(Name_size),
2 * union,
3 Address char(Addr_lines*Addr_size), /* address */
3 addr(Addr_lines) char(Addr_size),
2 * char(0);
dcl One_Name_addr char(size(Name_addr(1))); /* 1 name/addr*/
dcl Two_Name_addr char(length(One_Name_addr)
*2); /* 2 name/addrs */
dcl Name_or_addr char(max(Name_size,Addr_size)) based;
dcl Ar(10) pointer;
dcl Ex entry( dim(lbound(Ar):hbound(Ar)) pointer);
dcl Identical_to_Ar( lbound(Ar):hbound(Ar) ) pointer;
If you change the value of any of the named constants in the example, all of the dependent declarations are automatically reevaluated.