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

Examples

In the following example, if the comparison is true (if A is equal to B), the value of D is assigned to C, and the ELSE unit is not executed.

  if A = B then
    C = D;
  else
    C = E;

If the comparison is false (A is not equal to B), the THEN unit is not executed, and the value of E is assigned to C.

Either the THEN unit or the ELSE unit can contain a statement that transfers control, either conditionally or unconditionally. If the THEN unit ends with a GO TO statement there is no need to specify an ELSE unit, for example:

  if all(Array1 = Array2) then
    go to LABEL_1;
  next-statement

If the expression is true, the GO TO statement of the THEN unit transfers control to LABEL_1. If the expression is not true, the THEN unit is not executed and control passes to the next statement.


Terms of use | Feedback

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