Thanks for info. This is good to know.
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of CRPence
Sent: Thursday, March 28, 2013 9:57 AM
To: rpg400-l@xxxxxxxxxxxx
Subject: Re: CHAIN on a Partial Key
On 27 Mar 2013 17:42, paultherrien@xxxxxxxxxxxxxxxxxx wrote:
<<SNIP>> If both records have the same values for all key fields that
make up the key then it could be either record is delivered, there is
no guarantee it will be one or the other. <<SNIP>>
FWiW: There can be a guaranteed order, *if* that order had been requested for the creation of the Access Path. That order is according to the Duplicate Key Ordering specification. Those ordering options are for LIFO, FIFO, and FCFO:
IBM i 7.1 Information Center -> Database -> Programming -> Database programming -> Setting up database files -> Describing access paths for database files -> Using keyed sequence access paths for database files
http://pic.dhe.ibm.com/infocenter/iseries/v7r1m0/topic/dbp/rbafofifoo.htm
_i Arranging duplicate keys i_
"If you do not specify the Unique (UNIQUE) keyword in data description specifications (DDS), you can specify how the system stores records with duplicate key values.
You specify that records with duplicate key values are stored in the access path in one of the following ways:
* Last-in-first-out (LIFO). When the LIFO keyword is specified (1), records with duplicate key values are retrieved in LIFO order by the physical sequence of the records. ...
...
* First-in-first-out (FIFO). If the FIFO keyword is specified, records with duplicate key values are retrieved in FIFO order by the physical sequence of the records.
* First-changed-first-out (FCFO). If the FCFO keyword is specified, records with duplicate key values are retrieved in FCFO order by the physical sequence of the keys.
* No specific order for duplicate key fields (the default). When the FIFO, FCFO, or LIFO keyword is not specified, no guaranteed order is specified for retrieving records with duplicate keys. No specific order for duplicate key fields allows more access path sharing, which can improve performance.
..."
FWiW: Join Logical files have a separate Duplicate Key Ordering capability for join duplicates; i.e. the JDUPSEQ specification.
--
Regards, Chuck
--
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.