Swap system(“bpxmtext”) to popen(“bpxmtext”) and read the output from the pipe
> On 8 Sep 2018, at 9:06 am, Charles Mills <[email protected]> wrote: > > I freely admit that this is basically a newbie type question (despite the > mainframe gray hairs I have earned). > > Based on advice on another thread I am now calling errno2() on certain > socket errors. I get back an integer that I dutifully display in hex: > > XXX0123I errno2 = x'12345678'. Look up using BPXMTEXT. > > That message kind of offends me. When I get a basic library error I use > strerror() to convert it to text. I would like to convert errno2() to text, > rather than telling customers to go look it up for themselves. > > If I wanted to call BPXMTEXT from within my program and capture the text > output, what would I to do? I'm sure I could solve this with enough > experimentation but the gray hairs have made me impatient. > > Something like system("bpxmtext %x") where I substitute the errno2() value > into the message. But (1) I read a warning about having to allocate stdin > and so forth, and (2) I would like to capture the output. I suspect those > two issues have the same solution, and perhaps someone could point me in the > right direction? > > Environment is started task, POSIX(ON), C++, any current release of z/OS. > > Thanks, > Charles > > ---------------------------------------------------------------------- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to [email protected] with the message: INFO IBM-MAIN ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
