I'm not sure anyone actually answered this question, so I'll give it a
shot:

Yes, you can run SQL in a CL, sort of -- what you actually do is to use
RUNSQLSTM and feed it a source member containing the statement(s) (yes,
you can run several statements in a row).  These SQL statements can do
anything that SQL can do except return result sets (i.e. you can CREATE,
INSERT, UPDATE, or DELETE, etc., but you can't simply SELECT).

What you may really be asking is can you duplicate the functionality of
OPNQRYF, in which you create a file in the CL and then use that file in an
RPG program called by the CL? The answer to that also is "yes", but you
wouldn't run SQL in the CL. Instead, you'd used embedded SQL in the RPG
program to create the result set you want and then process that the same
as you'd process the file created by OPNQRYF. You can use embedded SQL in
both RPG and RPGLE programs (you need to change the file types to SQLRPG
and SQLRPGLE, respectively).

hth,

midrange-l@midrange.com writes:
>Can you use SQL in a CL in the same fashion as query, such as to create a
>file(Like OPNQRYF). I would think you can.


Mike Naughton
Senior Programmer/Analyst
Judd Wire, Inc.
124 Turnpike Road
Turners Falls, MA  01376
413-863-4357 x444
mnaughton@juddwire.com



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.