Ted MacNEIL wrote:
I should have said:
"LEAVE & ITERATE should only be used to manage the current level."
Use flags/semiphores to continue to exit.
At least, that way you know what you have.
The intent of structured programming techniques, since their need was
recognized 40 years ago, has been to improve software reliability by
reducing program complexity.
Languages like REXX and Structured HLASM provide LEAVE and ITERATE as a
means of reducing program complexity. Both statements allow for the
specification of which of several nested constructs is to be exited or
iterated. This facility is important and, when used appropriately, will
reduce program complexity significantly.
Arbitrary avoidance of this capability will necessarily lead to
scenarios in which the programmer must define, set, and test additional
return codes, flags, or other program indicators, when exiting an inner
construct, in order to cause some outer construct to be exited or
iterated. If the nesting is quite deep, this extra handling will be
required at every intermediate level until the "target" level is finally
reached. While such programs can be said to "work", they are much more
fragile than programs written to exploit LEAVE and ITERATE as the
language allows.
I recommend a ranking system in which the inner-most, of several nested
constructs, is the most preferential target for exit/iterate and the
outermost such construct is the least preferential; the remaining
constructs ranked, as expected, according to nesting level. I view this
as a practical approach because experience with "world class" software
( O:-) ) has shown that it's better to exit/iterate an outer construct
than to introduce gratuitous program complexity to prove a point.
--
Edward E Jaffe
Phoenix Software International, Inc
5200 W Century Blvd, Suite 800
Los Angeles, CA 90045
310-338-0400 x318
[EMAIL PROTECTED]
http://www.phoenixsoftware.com/
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html