Re: Infinite Loops and Explicit Exits
From: Robert Wagner (spamblocker-robert_at_wagner.net)
Date: 11/02/04
- Next message: William M. Klein: "Re: Infinite Loops and Explicit Exits"
- Previous message: Robert Wagner: "Re: Infinite Loops and Explicit Exits"
- In reply to: Chuck Stevens: "Re: Infinite Loops and Explicit Exits"
- Next in thread: William M. Klein: "Re: Infinite Loops and Explicit Exits"
- Reply: William M. Klein: "Re: Infinite Loops and Explicit Exits"
- Reply: Lueko Willms: "Re: Infinite Loops and Explicit Exits"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 01 Nov 2004 23:04:29 GMT
On Mon, 1 Nov 2004 09:33:28 -0800, "Chuck Stevens"
<charles.stevens@unisys.com> wrote:
>What cannot be determined in all cases at compile time is whether a
>statement appears within the scope of an *out-of-line* PERFORM range, which
>is now defined basically as all those statements executed starting with the
>first statement at the beginning of the PERFORM range and ending when
>control is passed back to the PERFORM.
>
>That's one reason why I suggest that both EXIT PERFORM and EXIT PERFORM
>CYCLE be treated as CONTINUE at execution time if they are executed outside
>of an execution-time PERFORM range.
No, no. The programmer explicitly said to exit the current block of
code. If not under control of a PERFORM, EXIT PERFORM should be
treated as EXIT PARAGRAPH.
EXIT PROGRAM has the same flaw -- it becomes CONTINUE if the program
has not been called. GOBACK takes the more reasonable action of STOP
RUN.
Consider this example:
COPY-RECORD.
READ input-file
IF STATUS-CODE-1 NOT EQUAL TO ZERO
EXIT PERFORM
END-IF
MOVE input-record TO output-record
WRITE OUTPUT-RECORD.
Running this under the debugger rather than under a PERFORM will write
garbage to the output file.
>Raising some sort of exception, instead of simply ignoring the EXIT PERFORM,
>would certainly be another reasonable approach when the statement was
>executed outside of a PERFORM range (just as is the case for RETURN/RELEASE
>outside of SORT/MERGE input/output procedures) -- EC-FLOW-EXIT-PERFORM,
>perhaps? I'd argue against it being fatal, though ...
I'd welcome that. Also, an exception for any paragraph fallen into
when an option (STRUCTURED?) is set.
- Next message: William M. Klein: "Re: Infinite Loops and Explicit Exits"
- Previous message: Robert Wagner: "Re: Infinite Loops and Explicit Exits"
- In reply to: Chuck Stevens: "Re: Infinite Loops and Explicit Exits"
- Next in thread: William M. Klein: "Re: Infinite Loops and Explicit Exits"
- Reply: William M. Klein: "Re: Infinite Loops and Explicit Exits"
- Reply: Lueko Willms: "Re: Infinite Loops and Explicit Exits"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|