It doesn't appear there's a way to separate STDOUT from STDERR on QSH call from what I can tell.

Even when I attempt to write to STDERR from Python the output ends up in STDOUT. Calling Python script from a CL:

OVRDBF FILE(STDERR) TOFILE(QTEMP/PYSTDERR)
OVRDBF FILE(STDOUT) TOFILE(QTEMP/PYSTDOUT)
STRQSH CMD(&CMD)
DLTOVR FILE(STDERR)
DLTOVR FILE(STDOUT)

Python:
#Output messages to STDOUT for logging
print(dashes)
print("Start of Main Processing - " + time.strftime("%H:%M:%S"))

sys.stderr.write("spam\n")
os.write(2, b"spam2\n")

all of this output ends up in stdout including the last 2 lines where I attempt to write to STDERR.

Thoughts ?

Regards,
Richard Schoen
Web: http://www.richardschoen.net
Email: richard@xxxxxxxxxxxxxxxxx
Phn: (612) 315-1745
----------------------------------------------------------------------

message: 1
date: Fri, 2 Aug 2019 20:29:16 -0400
from: John Yeung <gallium.arsenide@xxxxxxxxx>
subject: Re: [IBMiOSS] How to get Python errors to cause MSGW job
status?

On Fri, Aug 2, 2019 at 7:09 PM John Yeung <gallium.arsenide@xxxxxxxxx> wrote:

My super-nice-to-have feature would be for Python calls to be wrapped
in such a way that stderr (which is where the tracebacks go, by
default) goes into the text of a CPF9898. I got the feeling that
Richard's more elaborate Python wrapper could probably be adapted to
do this.

I should note that the particulars of this may be tricky. The most critical issue is that the size of stderr is unbounded, whereas I'm pretty sure CPF9898 has a fixed (and comparatively small) maximum size. So it would be important to (1) just get the tail of the traceback into the CPF* message, and (2) also send the full traceback somewhere, most likely the job log or a spooled file. There are other niggling things, like error messages sometimes counting on a certain character alignment on the screen, but presumably you can get that kind of stuff from the "proper" full form once you've accommodated (2).

John Y.


This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 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].