Loyd

I am with you here - personal preference, of course, so we are ALL right!

I separate SETLL/CHAIN from the various READ* because you use a different BIF to test results. %found() (or %equal()) vs %eof(). So if I'm going to loop through multiple records, I'm inclined to SETLL and if %equal(), then READE and then a DOW not %eof() with another READE as the last item in the DO block. Perhaps with the non-priming technique of DOU %eof() and READE followed by IF %EOF(), there seem to be 2 tests instead of 1 at each pass - not so big a deal, maybe, but still... Maybe the compiler optimizes it, but I don't know that. As I think about it, it seems related to a principle I like to follow - don't do unnecessary repeated actions inside a loop.

JMNSHO
Vern

lgoodbar@xxxxxxxxxxxxxx wrote:
It "reads" wrong to me. To me CHAIN implies an intent to retrieve one
row and only one row, while SETxx/READE implies an intent of reading a
group of rows (1+). I also do not like mixing CHAIN as the prime and
READx as the looping construct. It looks like a mixed metaphor.

It's more personal preference than anything, likely due to starting with
RPG/IV (mid-1990s).
Thanks,
Loyd

"If we hit that bull's eye, the rest of the dominoes will fall like a
house of cards. Checkmate." --Zapp Brannigan




-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Tom Liotta
Sent: Saturday, November 28, 2009 4:20 AM
To: midrange-l@xxxxxxxxxxxx
Subject: Re: Difference between RPG III and RPG IV with CHAIN

Loyd Goodbar wrote:

IMO, chain is the wrong tool for looking at files with duplicate keys.
I've
only used chain when key values are unique, or SETxx and READxx for
duplicate-keyed files. Know your data...

Why? Especially for duplicate keys, CHAIN plus READE can work great. The CHAIN not only does the SETLL but also a 'priming' READ for a loop. Just wondering why it should be avoided.

Tom Liotta

p.s. Yes... late response. I'm almost at the point of "one list per week".


This thread ...

Replies:

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

This mailing list archive is Copyright 1997-2026 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.