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



One thing I am not clear on. Are you only interested in finding out whether
a record is in the database, i.e. key was found or is there information in
the record that you need to get out?

If you are doing a key check only (Is that Customer present, example) then
a SETLL is best because it only does a key check. It does not bring a
record into memory.

If you need additional information from the record, then CHAIN is what you
want because is going to a key check and read the record in one operation.


On Tue, Oct 15, 2013 at 2:52 PM, Mark S Waterbury <
mark.s.waterbury@xxxxxxxxxxxxx> wrote:

Hi, Vinay:

Consider that doing a SETLL followed by a test of an indicator and then
a READE requires two external program CALLs to the "database" routines
in the OS ... while doing a CHAIN requires only one external call to a
database routine within the OS.

Here we have some additional CALL "overhead" and if you are going to do
this "millions of times' that can add up.

So, if you can code it using a CHAIN, I would go that way.

But if you are going to position to a record and then read several
records with the same (partial) key, then it would make sense to do a
SETLL followed by a READE in a loop. Pseudocode:

SETLL
if Found then
READE
do while Found
... process the record ...
READE /* next record ? */
enddo
endif

Does that help?

Mark S. Waterbury

> On 10/14/2013 12:44 PM, Vinay Gavankar wrote:
Hi,

I know this has probably been hashed a lot of times, but which of this
is more efficient?

Doing a direct Chain or a SETLL and if %EQUAL doing a READE

I am accessing on a full unique key, but performing this millions of
times in a batch program.

Most of the times the record WILL be found.

Thanks
Vinay

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