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

Short-circuit evaluation

The test of the IF expression may be "short-circuited":

The code will short-circuit only some expressions however, namely those which are:

Naturally, an expression formed (possibly recursively) from the above and the NOT prefix operator and the AND or OR infix operators will also be short-circuited.

So, for example, given the following declares

    dcl A   bit(1);
    dcl B   bit(1);
    dcl C   bit(2);
    dcl D   bit(2);
    dcl P   pointer;
    dcl BX  based fixed bin(31);

Then the following IF statements would all be short-circuited:

    if A | B then
    if P = sysnull() | P->BX = 0 then
    if C = ''b & D = ''b then
    if A | (substr(C,1,1) & substr(D,2,1)) then

But the following IF statements would not be short-circuited:

    if C | D then
    if C & D then

Terms of use | Feedback

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