The DB2 command is a supported interface...
http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=/rzahz/rzahzdb2utility.htm

In fact, it's a portable interface that works across all platforms
http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=/com.ibm.db2.udb.apdv.sql.doc/doc/c0023559.htm

HTH,
Charles


On Fri, Oct 9, 2009 at 8:35 AM, Luis Rodriguez <luisro58@xxxxxxxxx> wrote:
Keith,

I seem to have read (maybe in this same forum) that this was an
unsupported feature, so *maybe* it should not be used in critical
apps. That said, it is a nice way to use a SQL (UPDATEs, DELETEs,
etc.) statement inside a CL. If you redirect your output to NULL, it
won't even show a terminal window:

QSH        CMD('DB2 "CREATE INDEX @SAPRH.pab0021ID1 ON +
            @SAPRH.PAB0021 (PERNR, SUBTY, FGBDT) +
            ">/dev/null')

Also, you can use CL variables as parameters. Just prefix them with a $ sign:

 QSH        CMD('DB2 "DELETE FROM @SAPRH.PABHIRE A WHERE +
             exists(Select 1 from spi.nmpp007  b where +
             a.ficha = b.ficha and b.cia <> $CODCIA)">/dev/null')

Regards,
Luis Rodriguez
IBM Certified Systems Expert — eServer i5 iSeries



On Fri, Oct 9, 2009 at 6:43 AM, McCully, Keith (Insurance, Technology
Services) <Keith> wrote:


Also, depending upon what you're trying to accomplish, you might be
able to go directly to a stream file from your "query" if you use SQL
instead.

QSH CMD('db2 "select cola, colb, colc from mytable where condition =
true" > /tmp/myfile.txt')

With the above, IFS file /tmp/myfile.txt will contain your output.  Try
it ... you might enjoy!  :)

Interesting post Dennis - this is the first time I've seen a reference
to calling SQL from QSH. Are there any restrictions in calling SQL this
way? Are there any other references?

Now to find a use for it!

Cheers

Keith
The Royal Bank of Scotland plc, Registered in Scotland No. 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB

Authorised and regulated by the Financial Services Authority.

This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer. Internet e-mails are not necessarily secure. The Royal Bank of Scotland plc does not accept responsibility for changes made to this message after it was sent.

Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that the onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is accepted by The Royal Bank of Scotland plc in this regard and the recipient should carry out such virus and other checks as it considers appropriate.

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


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