Re: Subroutine(s) at end re-execute(s) if EXIT statement missing



On Jun 27, 8:28 am, norm.raph...@xxxxxxxxx wrote:
FrankS <sapie...@xxxxxxxxxx> wrote on 06/26/2008 10:09:00 PM:

On Jun 26, 11:24 am, norm.raph...@xxxxxxxxx wrote:
I got caught by this after a bad edit.
If the EXIT statement before the "subroutine(s)"
in the procedure is missing, the procedure will
re-execute the subroutine code and not "RETURN"
without complaining about a missing execution of
a GOSUB statement.

There is absolutely nothing unusual about that behavior. The fact
that SUB1 was previously reached by a GOSUB is irrelevant. It's your
responsibility (as the programmer) to not make DCL re-enter a GOSUB'd
routine.

Yes, that's not in dispute. I said it was a bad edit, not a logic error.
The point is that DCL will execute a RETURN statement as a CONTINUE when
no prior GOSUB was executed; most programming languages (and we all know
DCL is not a programming language) will error-trap that behavior during
execution. A run-time warning would seem to be helpful for this.

I actually find this useful to test error handling. Placed
strategically,

$ RETURN %X18008002

simulates an ERROR, e.g.

But don't construe this as a comment on whether it *should* behave
this way.

AEF
.



Relevant Pages