× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



A chain will get the FIRST record that satisfies the partial key. If you
want the next record you would need to do a subsequent read or chain with
the key values of the 2nd record. 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.
But anyway, a chain is not going to care where the pointer is currently
pointed - it gets the first record that matches the key fields used.


Paul

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Rich Marion
Sent: Wednesday, March 27, 2013 7:09 PM
To: 'RPG programming on the IBM i (AS/400 and iSeries)'
Subject: RE: CHAIN on a Partial Key

I am curious... Does the CHAIN with a partial key get the next record that
match the partial key or always the first.

What would:
CHAIN 1
CHAIN 1
CHAIN 2
Result?

Could the CHAIN with the partial key be functioning like a READE with the
exception that when the pointer is NOT on a record that matches the partial
key it automatically performs a SETLL first?

Rich

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Paul Therrien
Sent: Wednesday, March 27, 2013 3:26 PM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: RE: CHAIN on a Partial Key

You will always get the records with item and warehouse in the correct
sequence even if you only chain with item.
Sample

Item Whs
1 A
1 B
1 G
1 2
2 B
2 3

Chain with item 1 gets whs A
Chain with item 2 gets whs B


Paul

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Sam_L
Sent: Wednesday, March 27, 2013 4: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.

--
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.




-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2013.0.3267 / Virus Database: 3161/6208 - Release Date: 03/27/13


--
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.

This thread ...

Replies:

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

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.