Order of evaluation
PL/I statements often contain more than one expression or reference. Except as described for specific instances (for example, the assignment statement), evaluation can be in any order, or (conceptually) at the same time.
Consider the following example:
dcl (X,Y,Z) entry returns(float), (F,G,H) float;
F = X( Y(G,H), Z(G,H) );
The functions Y and Z can change
the value of the arguments passed to them. Hence, the value returned
by X might be different depending on which function
is invoked first. You should not presume that the first parameter
is evaluated first. In some situations, it is more optimal to evaluate
the last first.
Assuming that the INC function increments the value of the argument
passed to it and returns the updated value, the example that follows
could put out B(1,2) or B(2,1) depending
on which subscript is evaluated first. You should not presume which
subscript is evaluated first.
dcl B(2,2);
I = 0;
put list ( B( INC(I), INC(I) ) );