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



On 2010-10-15 09:27:00 -0600, "Parrish, Vilena R." <VParrish@xxxxxxxxxxxxxxxxxxxx> said:

CALL PGM(QP2SHELL) PARM('/QOpenSys/usr/bin/-sh' '-c' &CMD)

I would not recommend using QP2SHELL2 to run a shell script as you are doing here. When you use QP2SHELL2, the /QOpenSys/usr/bin/sh shell will run within the same job/process as your CL program and therefore the shell inherits the same stdin, stdout, stderr file descriptors from your CL program. These descriptors are not "genuine" stream file descriptors and are not designed to be further propagated to the child processes that the shell will create to run the command(s) in your &CMD command. Usage Note 2 from the QP2SHELL2 documentation also attempts to describe this situation:
http://publib.boulder.ibm.com/infocenter/iseries/v7r1m0/topic/apis/qp2shell.htm

Instead, I would do something like this:
QSH CMD(&CMD)
Qshell will spawn a new job/process to run your &CMD and that new process will have "true" stream file stdin/stdout/stderr that a shell processor needs. But note you'll likely need to adjust the value of &CMD to prepend the shell processor as you have /QOpenSys/usr/bin/sh -c (And also note I don't believe Qshell will recognize the login shell indicator "-" in you're currently using in "/QOpenSys/usr/bin/-sh", but perhaps you don't really need or want to do login shell processing here?


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.