I'm doing the LF to blank in the C code -- have a library routine to do that 
already, so just as easy as tr.

> How do you tell original line feeds from original blanks so everything 
> doesn't just flow together?

I don't think I need to. Here is my "flowed" output. I think plenty readable 
enough. Picture this as part of a mainframey message XYZ0123E Error blah blah

TCPIP  JRConnTCBNotFound: A TCB was not found for the specified socket.  
Action: Use a valid socket descriptor.         
or                                                                              
                          
TCPIP  JROK: The return code value describes the error  Action: Refer to the 
return code for information on the error.

Ah! pclose(). Got it. I was using fclose() but I see I have a potential timing 
issue there, and pclose() is where I where I would get an error status from. I 
will try it with a command of bpxmfoo and see if I can detect the error.

Thanks for your help, @Gil and all. It takes a friggin' village to wade through 
the IBM documentation.

Charles


-----Original Message-----
From: IBM Mainframe Discussion List [mailto:[email protected]] On Behalf 
Of Paul Gilmartin
Sent: Monday, September 10, 2018 3:50 PM
To: [email protected]
Subject: Re: How call BPXMTEXT from Posix STC

On Mon, 10 Sep 2018 17:36:18 -0500, Paul Gilmartin wrote:

>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");
> 
Silly me!  If you intend to get status from pclose(), leave out the "| tr ...".
You'd get the status from tr, which hardly ever fails.

How do you tell original line feeds from original blanks so everything
doesn't just flow together?

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to