blocklabel

LEAVE/NEXT should specify a blocklabel

Rule "blocklabel" gives this warning when it finds a LEAVE or NEXT statement without a blocklabel. For example:

  DO WHILE TRUE :
     FOR EACH customer :
        FOR EACH order OF customer :
            IF order.shipped THEN DO:
               DISPLAY order.shippingdate.
               NEXT.
            END.
            ELSE
               RUN something.
        END.
     END.
  END.

In this example, Prolint will give the warning for NEXT on the 6th line.

the risc:

It is not really clear on which iteration you want to perform the NEXT statement. Of course the compiler will make a decision and
actually we can predict what that decision is going to be, but still, there is no way of knowing which
block the programmer had in mind and we can also not read what the intended functionality is.

how to solve this:

Add a blocklabel, like:

audit_salesrep:
  FOR EACH SalesRep :
     FOR EACH customer OF SalesRep :
        FOR EACH Order OF Customer :
            IF order.shipped THEN DO:
               DISPLAY order.shippingdate.
               NEXT audit_salesrep.
            END.
            ELSE
               RUN something.
        END.
     END.
  END.

How to suppress these warnings:

You can put the directive {&_proparse_ prolint-nowarn(blocklabel)} directly before
the NEXT/LEAVE statement. See also: suppress warnings.

implementation:
This rule is implemented in Turbolint.