× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: RE: ILE RPG:Is the use of ITER & LEAVE Structured Programmin
  • From: Hans Boldt <boldt@xxxxxxxxxx>
  • Date: Thu, 23 Apr 1998 12:37:50 -0400

Oh boy!  A religious debate!

As others have suggested, who cares if LEAVE and ITER aren't
true structured programming ops!  30 years ago, there were lots
of programmers who were not convinced of the benefits of SP.
But today, few give it a second thought.  Today, most programmers
have a good idea of what good programming style is and code
appropriately.  The primary goal is (or should be) code that is easy
to understand and maintain.  Using SP does not guarantee that.
On the other hand, easy to understand programs generally follow
the "rules" of SP.  My point here is that SP is more a characteristic
of good code rather than a prescription.

One characteristic of programs that can make them more difficult
to understand is deep nesting.  LEAVE and ITER can help you
to limit the depth of nesting.  Sure, on a local level they violate
the principle of "single entry, single exit". However, a loop that
has LEAVE or ITER coded within it still has that "single entry,
single exit" characteristic.

Regarding the rumored LEAVESR opcode, it has already been
coded and tested and will most likely appear in the next release
of RPG IV.  (I don't want to be too committal!)  This was added
since many RPG programmers wanted it.  Perhaps we could
have spent our time better elsewhere, but I don't think we could
satisfy as many people implementing something different for the
hour or so it took to do LEAVESR.

Cheers!  Hans

Scott wrote:
> I am on your side.  ITER and LEAVE are not structured programming.
> They are just GOTOs in disguise.  Rumor has it that IBM is working on
> another one that will allow a person to leave an subroutine in the
> middle
> of it. I ask why?  Couldn't their time be better spent elsewhere?
> Wouldn't
> this be the same as a GOTO and a TAG??
>
> I view Structured Programming as one entry point/one exit point.
> DO loops are entered at the top and you exit at the bottom.  Same
> with Subroutines.  I just don't like that leaving something in the
> middle.
> It can make debugging somebody else's code more difficult.


Hans Boldt, ILE RPG Development, IBM Toronto Lab, boldt@ca.ibm.com
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.