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



Your pseudo code raises what may be a dumb question: Is the If Found test
following the setll needed? I was under the impression (maybe lucky) that
if the setll failed, the reade would still return eof.

I can't even remember if I coded it that way using COBOL on a non IBM
system many years ago - position, test, read, loop . Been too long.

John McKee


On Tue, Oct 15, 2013 at 3: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 ...

Follow-Ups:
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.