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

IBM1181: miscoded DO loops

Some programs that have always compiled cleanly may now produce this message:

  IBM1181I W A WHILE or UNTIL option at the end of a series DO specifications
             applies only to the last specification.

This message is produced for statements such as the following:

DO I = 1, 2 WHILE( X = ’Z’ );

This message says that this DO-loop will be executed once with I equal to 1 (whether or not X = ’Z’ is true) and then, if X = ’Z’ is true, with I equal to 2. This DO statement is not the same as this statement (although this is probably what the author intended:

DO I = 1 WHILE( X = ’Z’ ), 2 WHILE( X = ’Z’ )

If this was what you intended, it would probably be best to code the statement as:

DO I = 1 TO 2 WHILE( X = ’Z’);

And, if you did want to test if X = ’Z’ only before the second iteration of the DO-group, then it would be best to code the statement as:

DO I = 1 TO 2 UNTIL( X ^= ’Z’ );

Terms of use | Feedback

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