|
In my experience it has been FIFO, but you have to realize what "unpredictable" means, same thing as "undefined". It means that in V5R2 it may be the last record if it makes the compiler easier to make. Means whatever it returns now doesn't' necessarily mean it will return the same thing tomorrow, so don't count on it. Regards, Jim Langston -----Original Message----- From: Frank.Kolmann@revlon.com [mailto:Frank.Kolmann@revlon.com] Sent: Sunday, May 12, 2002 8:55 PM To: rpg400-l@midrange.com Subject: Using CHAIN instead of SETLL AND READE to begin a loop which reads a group Looks to me like the issue here is 'What does CHAIN retreive when used on a file with duplicate keys.' Long time ago I was told by IBM that the record retreived by the CHAIN is unpredictable. Experience tells that the retreival is FIFO. Has anyone noticed anything other than the above. Frank Kolmann >To: rpg400-l@midrange.com >From: "Mark Adkins" <adkinsm@amerch.com> > >I can't find any documentation that addresses this. > >If there is a table of order detail which has an index on Order #, and UPC. >Will these two pieces of code execute identically. > >1. MYORD# CHAIN ORDDTL 99 > *IN99 DOWEQ*OFF > <SOMECODE> > MYORD# READE ORDDTL 99 > ENDDO > >2. MYORD# SETLL ORDDTL > MYORD# READE ORDDTL 99 > *IN99 DOWEQ*OFF > <SOMECODE> > MYORD# READE ORDDTL 99 > ENDDO > >What if the index is not unique? What if I set my pointer past the end of >file before execution? > >Human logic dictates that a CHAIN should return the first occurrence of the >index which would be the smallest upc. Computer implementation dictates >that the CHAIN should return the first occurrence of MYORD# found via an >algorithm. > >Mark _______________________________________________ This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l or email: RPG400-L-request@midrange.com 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.