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



Hi, Rob,

When people say they want "embedded SQL" in CL, it is usually because they need to write a little utility to rifle through some selected rows and "do something" -- such as issue some CL command(s) -- based on each row.


SURPRISE!   You can accomplish this right now, today, in CLP or CLLE  ...  here's how ...

https://code.midrange.com/0814749817.html


In this example, I use the IBM-supplied RUNSQL command; you could change it to use any of the various RUNSQLxxx commands that are readily available. ;-)


On the OPNQRYF command, I use the KEYFLD parameter to specify the order, as SQL VIEWs do not support the "ORDER BY" clause.  (If you do not care about the sequence that rows are returned and processed, you can omit that parameter.)


For DCLF to compile correctly, you need to create the SQL VIEW in QTEMP at (or prior to) "compile-time."   This can be automated by using Alan Campin's COMPILE command that lets you place commands in the source code as specially formatted comments, so that you control exactly what happens when you "COMPILE" a source member ... you can find this free tool at: http://www.think400.dk/downloads.htm ; :)   Scott Klement also has a similar "pre-compiler" tool.  And there are several others out there, as well.


Enjoy!
Mark S. Waterbury


As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.