Re: Infinite Loops and Explicit Exits

From: Howard Brazee (howard_at_brazee.net)
Date: 11/02/04


Date: Tue, 2 Nov 2004 17:28:34 GMT


On 2-Nov-2004, l.willms@jpberlin.de (Lueko Willms) wrote:

> I.e. it completely obfuscates the program flow. When reading such a
> piece of code with a "EXIT PERFORM" in the middle, which does not
> refer to a PERFORM ... END-PERFORM, one has not the slightest idea of
> the consequences of such statement.
>
> It should be avoided.

Think of a maintenance programmer.

        PERFORM OLD-PARAGAPH VARYING...
        ...
        ...
        PERFORM OLD-PARAGAPH VARYING...
        ...
        ...
        PERFORM OLD-PARAGAPH VARYING...

   OLD-PARAGRAPH.
            ...
        ...
        ...
        IF FUNNY-CONDITION Get the hell out of Dodge...
        ...
        ...
        ...

The least intrusive way of coding "Get the Hell out of Dodge" is to exit the
perform. And "least intrusive" is a valuable characteristic of maintenance
programming.