Thanks.
OK I will have to explain what I'm doing AROUND this request.
I am reading a clients file with the cycle<!> and for each client chaining to a product file for information P1.
FClients IP E
FProductsIF E
Chain clientNum products
Etc.
Now, for reasons I won't explain here, a particular type of client means I have to go to another Product file, that has the information P1 in another productinformation file.
So, without SQL, I'd add
FProducts2 IF E
FProducts2Information IF E
Then chain to products2, if found chain products2Information etc.
So, for a quick fix, I did,
EXEC SQL
SET : P1 = (
SELECT P1 FROM Products2Information JOIN Products2 ON Products2.ID =Products2Information.ID2
WHERE Products2.product= : ClientProduct );
Which I put in a procedure GetP1 ( ). I realize I have to limit the search to one row. The right LF exist already so I don't need to create indexes. I haven't tried it yet so I don't know about performance.
-----Message d'origine-----
De : rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] De la part de Walden H. Leverich
Envoyé : jeudi 8 janvier 2009 20:10
À : RPG programming on the IBM i / System i
Objet : RE: SQL question
I think David's question comes from prior admonishments not to use SQL
for record-at-a-time access; use RPG for RLA and SQL for set at a time.
I'll leave that alone. :-)
Overall, good guideance, but as my first response says, a single
statement by itself is not usually GOOD or BAD.
Fair enough.
What he's doing around that statement would make a difference.
A HUGE difference. First off, that's at least two different IOs in a RLA mode, since he's doing a join. And if the join is serving to limit the selected rows in the first table then it could be many more IOs in RLA land.
-Walden
--
Walden H Leverich III
Tech Software
(516) 627-3800 x3051
WaldenL@xxxxxxxxxxxxxxx
http://www.TechSoftInc.com
Quiquid latine dictum sit altum viditur.
(Whatever is said in Latin seems profound.)
--
This is the RPG programming on the IBM i / System i (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.