These days, programming the logic for let's say "look ahead" fields is trivial. Just loop through all records, save each record as the "previous" record, and begin processing after reading the second record, and one extra last processing step after reading the last record (in which the "current" record is blank).
It's a trivial piece of code, as are level breaks (compare current field with previous), matching record (read two files concurrently, read a record from the first or second depending on equal fields) etc.
Instead of using the "built-in" cycle logic it's not much programming to code it yourself, which makes it explicit, you only code what you need (in 99% one does not need the MR processing). Also, it's all more flexible, because you're not contrained to what the cycle gives you out of the box. Because if this happens, you have to program it all yourself anyway, so that youo have to completely reprogram because you can't use the cycle.
In the old days, i.e. the 50's and 60's, RPG was intended for non-programmers. In this era, for accountants and the like, programming "look ahead" and "level breaks" was NOT trivial. In fact, programming was an esotheric activity, practiced by men in white coats. So in this context, presenting a cycle with the most commonly used algorithms, with some flexibility (like specifying the "level break" fields), to produce a simple report was genius. But, as is too common in the as/400 world, there was not much progress in RPG since, until about ten years ago when more "modern" concepts where introduced, like "free format" (sigh) and modular programming, which slowly, very very slowly, are adapted in the RPG world.
Jacobus> Date: Sat, 15 Dec 2007 00:10:50 -0800> From: qsrvbas@xxxxxxxxxxxx> To: rpg400-l@xxxxxxxxxxxx> Subject: Re: Multi- Occurrence Data Structure> > Larry Ducie wrote:> > > 7. Re: Multi- Occurrence Data Structure (Larry Ducie)> > > > I will not expect them to write programs which USE the cycle because it is> > not a relevant construct for us.> > > > I contest the idea that putting explicit do-loops for explicit file reads> > adds unnecessary complexity to a program. On the contrary, I believe it> > removes the obfuscation that the cycle introduces. The whole point of doing> > something explicitly is to make it clear to the next developer what the> > program is doing. They can see clearly because it is constructed right> > before their eyes.> > Yet we have no problem accepting the implicit "Cycle" that's a> fundamental aspect of SQL set-at-time processing. We _expect_ developers> to understand it. I'm not clear on when/why one language is acceptable> for "Cycle" encouragement and another must be considered to be > 'obscuring' or confusing.> > Tom Liotta> > -- > > Tom Liotta> The PowerTech Group, Inc.> 19426 68th Avenue South> Kent, WA 98032> Phone 253-872-7788 x313> 253-479-1416> Fax 253-872-7904>
http://www.powertech.com> -- > 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.>
_________________________________________________________________
Probeer Live Search: de zoekmachine van de makers van MSN!
http://www.live.com/?searchOnly=true
As an Amazon Associate we earn from qualifying purchases.