The definition of Chain is a Random Retrieval from a File.
If IBM tells me something is random, I take that to heart.
Because, how the database retrieval works today might not be how it works
under a different version of the operating system. There are too many
variables to try and decipher. (does your file reuse deleted records? If all
logical files are deleted and rebuilt, the sequence they are rebuilt in also
can have an effect)
As others have suggested, to eliminated all doubt, sounds like you should be
using SETLL and READE.
Documentation is the IBM RPG ILE Programmer Reference.
http://pic.dhe.ibm.com/infocenter/iseries/v7r1m0/index.jsp?topic=%2Frzasd%2F
sc092508914.htm
Chain has been defined as random retrieval for as long as I can remember.
Charlie
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Sam_L
Sent: Wednesday, March 27, 2013 5:19 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: CHAIN on a Partial Key
I have a logical file uniquely keyed on ITEM and WAREHOUSE.
I have found an (incorrect) program that does a CHAIN to this logical using
just ITEM. (The assumption may have been that it would get the lowest
WAREHOUSE which is where most stock is, but it is old code and I can't ask
anyone.)
I believe it sometimes gets a record that isn't the lowest WAREHOUSE and
ITEMS sometimes vanish from a report because there is no stock in this
warehouse.
Some eagle eyed person found items missing from a report from last year.
We restored the PF and the LF from a backup tape to another library, reran
the report, and the missing items correctly turned up.
I believe that there is no guarantee that if you do a CHAIN on ITEM that you
are guaranteed to get the record with the lowest value of WAREHOUSE and that
randomly we get another record.
Others are skeptical that I have found the cause, but it is a complicated
program stack and we haven't found any other reason.
Question 1: Am I on solid ground with my belief?
Question 2: Does any one know of any documentation on this subject?
Thanks, Sam
--
This is the RPG programming on the IBM i (AS/400 and 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.