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


  • Subject: Re: SQL Statements embedded in RPG
  • From: "R. Bruce Hoffman, Jr." <rbruceh@xxxxxxxxxxxxx>
  • Date: Thu, 17 Feb 2000 11:01:21 -0500

This might upset some people, but...

Don't.

Use a join. Build the data you want, the way you want it and then go get it.

so... instead of ....

            dou

            reade

            exsr    two

            end

    two    begsr

            reade

            exsr    doit

            end


it becomes...


EXEC SQL declare mydata cursor for select a, b, c from f1 join f2 on f1.key
= f2.key where d = :var
        dou    SQLCODE <> *zeros
EXEC SQL fetch mydata into :fielda, :fieldb, :fieldc
        exsr    doit
        end


and, yeah, I know my do until is all backwards, but you get the idea....


===========================================================
R. Bruce Hoffman, Jr.
 -- IBM Certified AS/400 Professional System Administrator
 -- IBM Certified AS/400 Professional Network Administrator

"The sum of all human knowledge is a fixed constant.
    It's the population that keeps growing!"

-----Original Message-----
From: JFinney@omnia.co.za <JFinney@omnia.co.za>
To: RPG400-L@midrange.com <RPG400-L@midrange.com>
Date: Thursday, February 17, 2000 10:17 AM
Subject: SQL Statements embedded in RPG


>Hi All,
>
>I've recently started to "get my hands dirty" with SQL on the '400 and am
>battling to get my head around some issues.
>Say, for instance, in traditional RPG logic + LF's, one would chain/reade
>(loop) a logical and, for each record, go to
>another loop and chain/reade based on a key (keeping it simple to start,
>assume the unique key to be one field from the
>original LF).
>
> What would the SQL statement look like to do the equivalent of what's just
>been explained in the previous paragraph ?
>
>Hope this question is clear enough (seems a little murky upon a re-read).
>If anyone is unclear, please e-mail me and I'll
>try to ask with a little more clarity.
>
>Regards
>John.
>
>
>+---
>| This is the RPG/400 Mailing List!
>| To submit a new message, send your mail to RPG400-L@midrange.com.
>| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
>| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
>| Questions should be directed to the list owner/operator:
david@midrange.com
>+---
>

+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.