Re: Infinite Loops and Explicit Exits

From: William M. Klein (wmklein_at_nospam.netcom.com)
Date: 11/02/04


Date: Mon, 01 Nov 2004 23:16:10 GMT

Response to first note in thread

As the person who wrote the initial proposal to add EXIT PARAGRAPH/SECTION
syntax to the 2002 Standard (based on the JOD definition from the late 70's or
early 80's),

I *like* the EXIT PERFORM <cycle> from within an out-of-line PERFORM for a
reason that I don't think has been mentioned yet in the thread (but I haven't
read it all yet).

Currently the EXIT PARAGRAPH/SECTION syntax can cause VERY unexpected results if
you have code where PERFORM xxx-SECTION (still used more commonly in Europe than
PERFORM xxx-para) and PERFORM xxx-para and GO TO statements. If a "generic"
EXIT (out-of-line) PERFORM statement were added, this could be avoided an
"better" structured and maintainable code could be created.

Consider (for example)

Procedure Division.
  PARA1.
     Perform Para2
     Go to Para2.
  Para2.
      Exit Paragraph.

***

Many more complex (real world) examples show how mixtures of the 3 types of
control transfers can cause SERIOUS problems with the current EXIT statements.

-- 
Bill Klein
 wmklein <at> ix.netcom.com
"Chuck Stevens" <charles.stevens@unisys.com> wrote in message 
news:clu41g$1t2b$1@si05.rsvl.unisys.com...
> For those who have been following the "perform forever" and "exit perform
> [cycle]" threads, I'm just tidying up the first drafts of two proposals that
> I hope to submit Real Soon Now to INCITS/J4 for evaluation and consideration
> for a future standard, if nothing else so that they can be added to the
> "candidates list" for future consideration.
>
> One of these proposals relaxes the current restriction that an EXIT PERFORM
> or EXIT PERFORM CYCLE statement may only appear within a PERFORM ...
> END-PERFORM range.
>
> The other proposal is for PERFORM ... UNTIL FALSE.   I didn't want to add a
> new reserved word and for that reason rejected PERFORM ... FOREVER.  I was
> concerned about the potential semantic ambiguities that one might encounter
> in sequences like "PERFORM ... PERFORM ... UNTIL EXIT PERFORM ...
> END-PERFORM ...", which led me away from PERFORM ... UNTIL EXIT.  I don't
> care for PERFORM ... WITH NO TEST because it really doesn't convey the sense
> of iteration.  I am not wedded to the syntax I chose, but I think the
> technical reasons for avoiding the other three here presented are sound.
>
> Unless WG4 so directs, these capabilities can't be included in the proposed
> 2008 standard.  But I can envision no technical barrier at all to the second
> of these, and the only barriers I can envision to the first are
> implementor-specific, WG4 *might* acquiesce so long as the additions do not
> cause a delay in the production of that next standard.
>
> At the very least this action on my part will ensure that these topics are
> on the standards committees' radar screens, and stimulate the discussion and
> clarification as to why EXIT PERFORM (with or without CYCLE) was limited to
> inline PERFORMs in the 2002 standard.
>
>    -Chuck Stevens
>
> 


Relevant Pages

  • Infinite Loops and Explicit Exits
    ... for a future standard, if nothing else so that they can be added to the ... One of these proposals relaxes the current restriction that an EXIT PERFORM ... or EXIT PERFORM CYCLE statement may only appear within a PERFORM ... ...
    (comp.lang.cobol)
  • Re: If you were inventing CoBOL...
    ... I can't get COBOL to produce a *floating* version of the most common ... EXIT PARAGRAPH and EXIT SECTION provide good support for structure ... disallowed in other contexts in the '02 standard. ... EXIT PARAGRAPH and EXIT SECTION are big helps here. ...
    (comp.lang.cobol)
  • Re: Is it possible to use the value of the PROGRAM ID within the source code?
    ... This was used by some compilers to generate null code that ... I can't recall a mandatory EXIT, even on the earliest IBM compilers. ... >paragraph without a statement until the '74 standard. ... During meetings to formulate a Programming Standard, ...
    (comp.lang.cobol)
  • Re: Infinite Loops and Explicit Exits
    ... 04-0195 -- Provide Explicit Infinite Loop Capability ... for a future revision of the standard. ... > One of these proposals relaxes the current restriction that an EXIT ... > or EXIT PERFORM CYCLE statement may only appear within a PERFORM ... ...
    (comp.lang.cobol)
  • Re: EXIT SECTION/PARAGRAPH
    ... ISO2002 bubble ... But they only mark EXIT PARAGRAPH/SECTION/CYCLE with MF bubbles. ... conform to the '02 Standard for this feature. ... are you assuming that EXIT PARAGRAPH as an ...
    (comp.lang.cobol)