Rational Developer for System z
Enterprise PL/I for z/OS, Version 3.8, Language Reference Manual

Infix operators and arrays

Infix operations that include an array variable as one operand can have an element or another array as the other operand.

Array-and-element operations

The result of an expression with an element, an array, and an infix operator is an array with bounds identical to the original array. Each element of the resulting array is the result of the operation between each corresponding element of the original array and the single element. For example:

  If A is the array         5  10   8
                           12  11   3
 
  then A*3 is the array    15  30  24
                           36  33   9
 
  and 9 > A is the array of   1   0   1
  bit strings of length 1     0   0   1

The element of an array-element operation can be an element of the same array. Consider the following assignment statement:

  A = A * A(1,2);

Again, using the above values for A, the newly assigned value of A would be:

     50    100   800
   1200   1100   300

That is, the value of A(1,2) is fetched again.

Array-and-array operations

If the two operands of an infix operator are arrays, the arrays must have the same number of dimensions, and corresponding dimensions must have identical lower bounds and identical upper bounds. The result is an array with bounds identical to those of the original arrays; the operation is performed upon the corresponding elements of the two original arrays. For example:

  If A is the array          2   4   3
                             6   1   7
                             4   8   2

  and if B is the array      1   5   7
                             8   3   4
                             6   3   1

  then A+B is the array      3   9  10
                            14   4  11
                            10  11   3

  and A*B is the array       2  20  21
                            48   3  28
                            24  24   2

  and A>B is the array of    1   0   0
  bit strings of length 1    0   0   1
                             0   1   1

Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)