Hi Walt,
Thanks for the help and sorry for the late response. I'll try taking
the "-" out and see what happens. If that doesn't resolve it then I
will switch the program to use QSH. What I find really confusing is
that this only happens about once every month or so. The program this
runs in is called 3 different times everyday but only the 4:30 AM call
ever has an issue.
Thanks again,
Vilena Parrish
------------------------------
message: 2
date: Mon, 18 Oct 2010 14:37:01 -0600
from: Walt Madden <walterross@xxxxxxxxx>
subject: Re: QP2SHELL error
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/qp2sh
ell.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.