|
I see that, and understand and accept that. Different minds function different ways. My own brain says to me "Booth, do you need a Leave because your logic is messed up?" And, sadly, that is usually the case. --------------------------------- Booth Martin http://www.martinvt.com --------------------------------- -------Original Message------- From: RPG programming on the AS400 / iSeries Date: 01/31/05 15:23:26 To: RPG programming on the AS400 / iSeries Subject: Re: Suggested Technique The problem, Booth, is that some don't want to be bothered putting the F3 in a select or IF and then they have to worry about how to bypass the rest of the code. LEAVE takes care of that messiness for them. Rob Berendt -- Group Dekko Services, LLC Dept 01.073 PO Box 2000 Dock 108 6928N 400E Kendallville, IN 46755 http://www.dekko.com "Booth Martin" <booth@xxxxxxxxxxxx> Sent by: rpg400-l-bounces@xxxxxxxxxxxx 01/31/2005 04:08 PM Please respond to RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx> To "RPG programming on the AS400 / iSeries" <rpg400-l@xxxxxxxxxxxx> cc Subject Re: Suggested Technique While I understand the idea of DO *hival coupled with a leave, why not just say it in the first place, and have a DOU F3 and avoid the extra lines of coding? DOU F3 is pretty clear, too, isn't it? --------------------------------- Booth Martin http://www.martinvt.com --------------------------------- -------Original Message------- From: RPG programming on the AS400 / iSeries Date: 01/31/05 15:03:41 To: rpg400-l@xxxxxxxxxxxx Subject: Re: Suggested Technique Hi Alan, <snip> There are some brilliant programmers here, however, who advocate avoiding use of the "iter" and "leave" op-codes. I find it hard to avoid using them myself, but am still open on that issue. </snip> Now there's a statement! :-) I would be VERY interested to hear the reasons why LEAVE and ITER have entered the "Hall of Shame" along with CABxx and GOTO. Personally, I find them very useful and would need a very, very hard sell to convince me to stop using them. They do not preclude well structured code, they have definite branching end-points, and they do not make code less readable to a developer: All long-standing accusations levelled at CABxx and GOTO. For example - a classic screen loop: // Display screen... do *hival exfmt screen // If user presses F3, leave screen loop... if F3_pressed leave endif // Validate user input... validateInput() // If user enters invalid data, re-display screen, displaying error message... if userEntersInvalidData iter endif // If user elects to update current valid data, update and leave screen... if F8_update updateData() leave endif enddo For me this code is simple - you can only leave the screen if you press F3 or update valid data. How do I know??? There's only two ways to leave the screen - via the two LEAVE op-codes. If the code goes beyond the enddo then F3 or F8 MUST have been pressed. In the case of F8, valid data MUST have been entered. If the user enters invalid data then I force a re-display of the screen (ITER) before any update code is reached - this forms a nice code buffer, beyond which I am assured that the input data is valid. I also prefer using "do *hival" because I do not want any "implicit" exits of the loop. I want to see the exit strategy EXPLICITLY coded within the screen loop. My time is more precious than the CPU cycle time. If I can read/modify the code faster because there are large marker flags in front of me then my company saves money. It's the old adage - KISS! Just my preference. Cheers Larry Ducie -- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l. .. -- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l. -- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l. .
As an Amazon Associate we earn from qualifying purchases.
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.