Rational Developer for System z
Enterprise PL/I for z/OS, Version 3.8, Migration Guide

IBM1220: pointless comparisons

When compiling some of your code, you may also see the following new message:

  IBM1220I W  Result of comparison is always constant

For example, the following code would cause the new compiler to produce this message:

    DCL ZWSTRING     CHAR(80);
    DCL ZWSTRING2    CHAR(8);

    ZWSTRING = 'E R R O R';
    .....
    IF ZWSTRING2 = 'E R R O R' THEN

This message is produced because 'E R R O R' is CHAR(9) with its last character a non-blank, and hence it could never equal a CHAR(8) field.

Any code that produces this message is problematic and should be closely examined. In fact, ignoring this message when it points at a DO-loop statement means that your code could go into an infinite loop. For example, the compiler would produce this message for all three of these executable statements, and in the last case, the loop would run endlessly unless exited with a LEAVE statement:

    DCL ZZ9 PIC'ZZ9';
    DCL N  FIXED BIN(15);

    IF ZZ9 < 0 THEN  ...
    IF ZZ9 <= 999 THEN ...
    DO N = 1 TO 32768;  ...; END;

Note that if you have a loop that you want to run "endlessly" until exited by a LEAVE (or GOTO) statement, it would be best to code that loop statement using DO FOREVER.


Terms of use | Feedback

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