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



Heh... the simplest way is to call an RPG program ! (or any other HLL)

CL doesn't have an embedded SQL preprocessor. Tools like RUNSQLSTM and
QMQRY don't have a way of reading the result of a SELECT statement. I
suppose you could use one of those tools (RUNSQLSTM et al) to write the
results of your select statement to a file, then read the file with
RCVF... but I'd find that cumbersome.

One way to wrok around it is to use Qshell to run the SQL, and have it
write the result to a data queue. While CL is very limited in it's
ability to read files, it's not so limited with data queues. I wrote an
article about that, at the following link, if you're interested:
http://systeminetwork.com/article/read-sql-result-sets-cl-qshell

If you're running V5R3 or later, it's also possible to call the SQL CLI
APIs directly from CL. Perhaps not for the feint-of-heart, but it works
and doesn't require QShell or any other special licpgms.
http://systeminetwork.com/article/database-access-cl-sql-cli

So these are possibilities... but, IMHO, if you're already familair with
doing the SQL from RPG, and you're looking for the "easiest" solution...
the easiest solution is to call an RPG program from CL.



Hatzenbeler, Tim wrote:
I need to do a very simple 'select distinct' type of SQl, and have
the results go into an existing pf, what's the simplest way to do
this in a CL?

I normally use RPG for SQl, but this particular need doesn't require
any error checking or logic associated with it.


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.