Re: Perform loop enhancements

From: Chuck Stevens (charles.stevens_at_unisys.com)
Date: 10/28/04


Date: Thu, 28 Oct 2004 10:19:48 -0700


"Howard Brazee" <howard@brazee.net> wrote in message
news:clr6k5$ra8$1@peabody.colorado.edu...
>
> On 28-Oct-2004, "Chuck Stevens" <charles.stevens@unisys.com> wrote:
>
> > I agree that an out-of-line indefinite PERFORM pretty much requires
either
> > the despised GO TO or the prohibited EXIT PERFORM, but I'm not really
> > opposed to relaxing the restriction on the latter, unless someone
convinces
> > me that there's a good reason why it's there. .
>
> The question here is what would an EXIT PARAGRAPH do. I was assuming it
would
> do the same thing as an EXIT PERFORM does in an in-line perform.

"The execution of an EXIT PARAGRAPH statement causes control to be passed to
an implicit CONTINUE statement immediately following the last explicit
statement of the current paragraph, preceding any return mechanisms for that
paragraph." EXIT PARAGRAPH would NOT terminate the execution of an
out=of-line PERFORM, it'd just bypass the code that might have been executed
from the point at which it occurred to the end of the perform range.

> Some languages have two types of exits to their equivalents of performs.
> 1. Skip the rest of this iteration of the perform-loop and go to the
next
> iteration
> 2. Skip the rest of this iteration of the perform-loop and exit the
perform
> altogether.
>
> Both of these are useful tools, and both should be considered when
proposing
> this change.
>
> EXIT-CONTINUE anybody?

For out-of-line PERFORMs, the first can be handled by proper structure of
the code and EXIT PARAGRAPH; I'd be inclined to allow EXIT PERFORM in
out-of-line PERFORMs which I'd expect to provide the second. Again, given
all the enhancements to EXIT that went into the 2002 standard, I'm at
somewhat of a loss as to understand why this wasn't allowed in the first
place, unless it was intended as a "toe in the water" approach to the
construct to make sure it didn't fall over and break something.

Certainly I don't see a problem with allowing EXIT PERFORM in our
implementation; we were doing EXIT HERE in COBOL(68) as an extension back in
the Dark Ages (maybe mid 1970's?). In response to complaints that we
couldn't do the same thing in COBOL74, I added EXIT PERFORM in 1987 (using
the syntax proposed for the post-1985 standard) and haven't seen a single
indication of a failure involving it since.

    -Chuck Stevens



Relevant Pages

  • Re: Para1 THRU Para2 (was: Infinite Loops and Explicit Exits
    ... >care that it locks them in to that compiler. ... EXIT PARAGRAPH is in the current ISO Cobol standard .. ... I didn't measure one batch job nor a small benchmark program; ...
    (comp.lang.cobol)
  • Re: Bad habits of GOTO-using programmers
    ...     ... So those who are in favor of exit paragraphs still have a valid ... If you do an out-of-line PERFORM of a paragraph then EXIT PARAGRAPH ... when moving code between in-line and out-of-line. ...
    (comp.lang.cobol)
  • Re: Para1 THRU Para2 (was: Infinite Loops and Explicit Exits
    ... >> Under Micro Focus, which had EXIT PARAGRAPH for years, and all 2002 ... >Micro Focus has not yet implemented the full ISO 2002 Standard. ... provided EXIT PARAGRAPH. ... A small by-product of proper structuring is elimination of premature ...
    (comp.lang.cobol)
  • Re: Para1 THRU Para2 (was: Infinite Loops and Explicit Exits
    ... Robert Wagner wrote ... > provided EXIT PARAGRAPH. ... With a consistent style an exception to the rule can be found more ... also no 'EXIT PARAGRAPH' because that is currently non-portable. ...
    (comp.lang.cobol)
  • Re: Bad habits of GOTO-using programmers
    ... The fact that it contains only the word EXIT confirms its function. ...     perform section-a ... The results of the execution of overlapping PERFORM statements are ...     The exit to main is destroyed by the second perform of a-x. ...
    (comp.lang.cobol)