×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




Vern,
Am curious about your statement "The IBM one does not do SELECT statements,
as neither does RUNSQL..."

Since using the RUNSQL statement in a CLLE could be batch or interactive,
one has to provide where the Select stmt results will be placed.
This works fine for me (the statement was built from cl variables:

RUNSQL SQL(&STMT) COMMIT(*NONE) NAMING(*SYS)

(joblog of actual execution)

RUNSQL SQL('INSERT INTO TEST/MDC001PE
(SELECT * FROM MDC001P
WHERE ncsedt=20140925 and ncsetm=163932 and ncsvc=''MDC'')')
COMMIT(*NONE) NAMING(*SYS)

The developerworks wiki has samples of RUNSQL with "Select"
https://www.ibm.com/developerworks/community/wikis/home?lang=en#!/wiki/IBM%20i%20Technology%20Updates/page/Run%20SQL%20(RUNSQL)%20-%20new%20command

Jim Franz


On Thu, Sep 25, 2014 at 6:33 PM, Vernon Hamberg <vhamberg@xxxxxxxxxxxxxxx>
wrote:

Good point, Sam - many of us have written such a command over the years -
I think I got my first sample from Buck in these lists. These all take
advantage of the SETVAR parameter of STRQMQRY and have a QMQRY that is made
up only of substitution variables.

The IBM one does not do SELECT statements, as neither does RUNSQL. I
haven't got a good answer as to why not, so I've given up.

So whoever uses the code in the wiki, probably change the command name to
something like EXCSQLSTM.

Cheers
Vern


On 9/25/2014 3:35 PM, Sam_L wrote:

FWIW: There is an IBM RUNSQLSTM command that is not compatible with the
one in the Wiki.

Sam

On 9/25/2014 1:34 PM, Voris, John wrote:

The RUNSQLSTM is a great command and helps move you into the SQL world
with training wheels.
http://wiki.midrange.com/index.php/SQL (which uses SQL syntax and the
QM engine.)

From an SQL statement like RUNSQLSTM ' SELECT A.*, B.* from FileA A
join FileB B on KeyA = KeyB '

and using F4 to name your output file, there is no need to crank up old
WRKQRY to get an *OUTFILE.
You can do this with the custom RUNSQLSTM command.


---
This email is free from viruses and malware because avast! Antivirus
protection is active.
http://www.avast.com


--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.



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