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

How assignments are performed

Element assignments

Element assignments are performed as follows:

  1. First to be evaluated are subscripts, POSITION attribute expressions, locator qualifications of the target variables, and the second and third arguments of SUBSTR pseudovariable references.
  2. The expression on the right-hand side is then evaluated.
  3. For each target variable (in left to right order), the expression is converted to the characteristics of the target variable according to the rules for data conversion. The converted value is then assigned to the target variable.

Aggregate assignments

Aggregate assignments (array and structure assignments) are expanded into a series of element assignments as follows:

  1. The label prefix of the original statement is applied to a null statement preceding the other generated statements.
  2. Array and structure assignments, when there are more than one, are done iteratively.
  3. Any assignment statement can be generated by a previous array or structure assignment. The first target variable in an aggregate assignment is known as the master variable. (It can also be the first argument of a pseudovariable). If the master variable is an array, an array expansion is performed; otherwise, a structure expansion is performed.
  4. If an aggregate assignment meets a certain set of conditions, it can be done as a whole instead of being expanded into a series of element assignments. Two conditions are if the arrays are not interleaved, or if the structures are contiguous and have the same format.

In array assignments, all array operands must have the same number of dimensions and identical bounds. The array assignment is expanded into a loop as follows:

  do J1 = lbound(Master-variable,1) to
          hbound(Master-variable,1);
  do J2 = lbound(Master-variable,2) to
          hbound(Master-variable,2);

·
·
·
do Jn = lbound(Master-variable,N) to hbound(Master-variable,N); generated assignment statement end;

In this expansion, n is the number of dimensions of the master variable that are to participate in the assignment. In the generated assignment statement, all array operands are fully subscripted, using (from left to right) the dummy variables j1 to jn. If an array operand appears with no subscripts, it has only the subscripts j1 to jn. If cross-section notation is used, the asterisks are replaced by j1 to jn. If the original assignment statement has a condition prefix, the generated assignment statement is given this condition prefix.

If the generated assignment statement is a structure assignment, it is expanded as described next.

In structure assignments where the BY NAME option is not specified:

In structure assignments where the BY NAME option is given, the structure assignment is expanded according to the steps below, which can generate further array and structure assignments. None of the operands can be arrays.

  1. The first item immediately contained in the master variable is considered.
  2. If each structure operand and target variable has an immediately contained item with the same name, an assignment statement is generated as follows:
    1. The statement is derived by replacing each structure operand and target variable with its immediately contained item that has this name. If any structure contains no such name, no statement is generated.
    2. If the generated assignment is a structure or array-of-structures assignment, BY NAME is appended.
    3. All generated assignment statements are given the condition prefix of the original assignment statement.
    4. A target structure must not contain unions.
  3. Step 2 is repeated for each of the items immediately contained in the master variable. The assignments are generated in the order of the items contained in the master variable.

Terms of use | Feedback

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