On 6/20/2017 4:46 PM, Nathan Andelin wrote:
It appears that you may be interested in a generic (i.e. common, standard)
way of returning messages from Python scripts to CLPs. The use of IBM
call-stack message queues, *DIAG and *ESCAPE messages in that regard is too
confusing and problematic in my experience.
I have little doubt that many midrange programmers feel the same way. I
feel lucky that I was exposed to message handling early in my S/38
career - it seems not many of us were.
When users (Programmers?)
embed code in CLPs to receive messages from call-stack message
queues, it's never really clear to them what they may be looking for,
The pattern is that one monitors/handles for messages one expects, and
percolates messages one does not expect eg:
DCL &var...
MONMSG CPF0000 exec(goto stderr1)
...
DLTF NOFILE
MONMSG CPF2105 /* not exist */
...
RETURN
STDERR1: /* Standard error handling routine */
/* Set "Error in progress" switch */
IF &ERRORSW SNDPGMMSG MSGID(CPF9999) +
MSGF(QCPFMSG) +
MSGTYPE(*ESCAPE) /* Func chk */
IF &ERRORSW (GOTO END)
CHGVAR &ERRORSW '1' /* Set to fail if error occurs */
/* Re-send diagnostic messages */
STDERR2:
RCVMSG MSGTYPE(*DIAG) +
PGMQ(*SAME *) +
MSGDTA(&MSGDTA) +
MSGID(&MSGID) +
MSGF(&MSGF) +
MSGFLIB(&MSGFLIB)
MONMSG CPF0000 EXEC(GOTO STDERR3)
IF (&MSGID *EQ ' ') GOTO STDERR3
SNDPGMMSG MSGID(&MSGID) +
MSGF(&MSGFLIB/&MSGF) +
MSGDTA(&MSGDTA) +
MSGTYPE(*DIAG)
GOTO STDERR2 /* Loop back for addl diagnostics */
/* Re-send escape messages */
STDERR3:
RCVMSG MSGTYPE(*EXCP) +
MSGDTA(&MSGDTA) +
MSGID(&MSGID) +
MSGF(&MSGF) +
MSGFLIB(&MSGFLIB)
MONMSG CPF0000
SNDPGMMSG MSGID(&MSGID) +
MSGF(&MSGFLIB/&MSGF) +
MSGDTA(&MSGDTA) +
MSGTYPE(*ESCAPE)
SNDPGMMSG MSGID(CPF9898) +
MSGF(QCPFMSG) +
MSGDTA('MYPGM failed') +
MSGTYPE(*ESCAPE)
END:
ENDPGM
The key point here is that the global MONMSG traps all errors excepting
the ones which are handled at the point of failure by MONMSG after the
individual command.
because so many possibilities exist for finding messages in call-stack
message queues.
I'm almost certain that the above pattern was posted on this list many
years ago. It's one way to handle every exception message so that this
CLP will never hang on a MSGW; even if an eager developer decides to
implement RCAC on one of the tables and a brand new authority error ensues.
I know that you are a software house, and as such may not be at liberty
to share code; could you perhaps describe how your web-based back end
handles the unexpected?
As an Amazon Associate we earn from qualifying purchases.