On Mon, 10 Sep 2018 15:12:46 -0700, Charles Mills wrote:
>Ha! Thank you. I put only the "PATH=/bin bpxmtext ..." in and it works!
>Reading the file to the end I get
>
>TCPIP
>JRConnTCBNotFound: A TCB was not found for the specified socket.
>Action: Use a valid socket descriptor.
>
z/OS isn't really UNIX, y'know.
>I am going to convert line feeds to blanks so that it will all substitute
>nicely into a conventional z/OS style message.
>
That would be (untested):
FILE *errFile = popen("PATH=/bin bpxmtext 76697242 </dev/null 2>&1 | tr
'\025' '\040'", "r");
>Question: Do I have something here that should work at 99.9% of customers, or
>at least fail very gracefully? I don't want to create a new "hard" problem
>solving what is basically a cosmetic shortcoming. How do I recognize a
>failure? The FILE pointer was non-null even when the command failed. I suppose
>if the text read from the file were less than some reasonableness value? 20
>bytes?
>
Does pclose() report the status of the popen()ed command?
Sheesh! The doc says it doesn't even report buffer overflow. It's
irritatingly reasonable that popen() return the output of even a command
that reports an error.
Kludge with command substitution (untested):
if Answer=$( PATH=/bin bpxmtext ... )
then printf '%s' "$Answer"
else echo "BPXMTEXT failed"
fi
If PATH=/bin doesn't hurt anything, I'd feel more comfortable keeping it.
Likewise 0</dev/null.
-- gil
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN