×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




Generally speaking, single record (or small number of record) access is faster using the native I/O operations than it is using SQL. Also, when looking to see if a record exists and you don't need to know any data values, SETxx by itself is about as fast as you can get.

Matt

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of David FOXWELL
Sent: Tuesday, April 01, 2008 8:27 AM
To: RPG programming on the AS400 / iSeries
Subject: Wrongly using embedded SQL

Hi,

I've seen a lot of debates about embedded SQL versus RPG. Couldn't we have some kind of guideline in the WIKI to help choose between the 2 ?

I have the following problem. I have a file with 4.5 million records. I have to see if a client exists in the file with a mouvement created at a certain date.
I will create a procedure for this.

Should I use SETLL then READE with the client until I find the record or should I use SQL ?

What are the reasons for the choice ?

Performance ? I'm not qualified to say which would be best.
If I did it with SQL, I would also probably try different requests that I would test with Visual Explain. I mean, to see if at least 1 line exists, there's SELECT with FIRST ROW ONLY, COUNT(*) and EXISTS.

Readability ? The same in RPG or SQL. Or depending on which the following programmer is more used to.

Time taken to do the work? If I only had RPG, the job would already be done.



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



This thread ...

Replies:

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

This mailing list archive is Copyright 1997-2026 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.