|
Couple of things.
1) Instead of CHAIN, try SETLL as it does not read the record into the
buffer.
2) instead of Native I/O check out SQL, with the proper indexes it should be
even faster.
insert into updfile (select * from origfile
where key not in (select key from updfile)
)
Also, may want to try using the EXISTS predicate. I'm not real good with
its use but something like:
insert into updfile A ( select * from origfile B
where not exists ( select 1 from updfile C
where B.key =
C.key)
)
HTH,
Charles
> -----Original Message-----
> From: CarollaT@xxxxxxxxxxxxxx [mailto:CarollaT@xxxxxxxxxxxxxx]
> Sent: Friday, September 03, 2004 11:16 AM
> To: rpg400-l@xxxxxxxxxxxx
> Subject: CHAIN to a DS
>
>
> I have written some code that takes records in a temp file, and either
> updates or adds them to another file. It's the same old, "If
> the record
> exists, update, else write" scenario. The top factor for
> this little module
> is speed - We want this thing to scream, so I am trying to
> cut every corner
> I can, then I will document the you-know-what out of it later.
>
>
>
> Basically, I have the output/update file prefixed with a 'D',
> and I read the
> input record, attempt a chain to the output/update file, and
> move the fields
> (450+) from the input file to the output file (in case the
> chain found a
> record), and conditionally write or updated, based on %FOUND.
>
>
>
> So I am thinking about this, and I know that you can CHAIN,
> and read the
> resulting record into a data structure. What I am wondering
> is, since both
> files have the same format, and field names, can I CHAIN to the
> output/update file, but read the record in to a DS, and _not_
> udpate the
> fields in the record format. Does every successful chain
> have to send the
> fields to the input record fields? If not, then I would
> attempt the chain,
> and skip moving the 450+ fields to the output buffer, with
> the prefix.
>
>
>
> Thanks in advance for your help.
>
>
>
> Tony Carolla
>
> MedAmerica Billing Services, Inc.
>
> --
> This is the RPG programming on the AS400 / 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 mailing list archive is Copyright 1997-2025 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.