|
Dan,
We use the following to create the message queue:
/* ------------------------------------------------------------------*/
/* Create system message queue */
/* ------------------------------------------------------------------*/
CHKOBJ OBJ(QSYS/QSYSMSG) OBJTYPE(*MSGQ)
MONMSG MSGID(CPF9801) EXEC(DO)
CRTMSGQ MSGQ(QSYS/QSYSMSG) TEXT('Optional MSGQ to +
receive system messages')
ENDDO
CHGMSGQ MSGQ(QSYSMSG) DLVRY(*BREAK) PGM($BRKPGM)
/* ------------------------------------------------------------------*/
We use the following to monitor this message queue to take action:
This uses an old QUSRTOOL program to convert hex to decimal and our own
internal message forwarding program that you will find in the WYATTERP
distribution.
*************** Beginning of data **************************************
/* ------------------------------------------------------------------*/
/* $MONSYSMSG Monitor QSYSMSG message queue */
/* ------------------------------------------------------------------*/
/* NOTICE: THIS PROGRAM IS LICENSED MATERIAL AND THE PROPERTY OF: */
/* PROGRAMMER. . . . . .:James W. Kilgore */
/* DATE WRITTEN. . . . .: 5/24/95 */
/* ------------------------------------------------------------------*/
$MONSYSMSG: PGM
/* ------------------------------------------------------------------*/
/* Declare the program variables and copyright notice */
/* ------------------------------------------------------------------*/
DCL ©RIGHT *CHAR 128 +
VALUE('$MONSYSMSG (c) Copyright 1995, +
Licensed materials and the property of: +
James W. Kilgore; All rights reserved.')
/* ------------------------------------------------------------------*/
DCL &MSGF *CHAR 10 /* Message file name */
DCL &MSGFLIB *CHAR 10 /* Message file library */
DCL &MSGID *CHAR 7 /* Message identifier */
...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7
.
DCL &MSGDTA *CHAR 100 /* Message data */
DCL &MSG *CHAR 132 /* Message */
/* ------------------------------------------------------------------*/
DCL &DEVICE *CHAR 10 /* Device issueing error message */
DCL &MODE *CHAR 8 /* Mode of device */
DCL &REASONB *CHAR 2 /* Reason code - Binary */
DCL &REASOND *DEC (5 0)/* Reason code - Decimal */
DCL &RMTLOC *CHAR 8 /* Remote location name */
/* ------------------------------------------------------------------*/
/* Job attributes */
DCL &JOB *CHAR 10 /* Job name */
DCL &JOBUSER *CHAR 10 /* Job user id */
DCL &JOBNBR *CHAR 6 /* Job number */
DCL &JOBTYPE *CHAR 1 /* Job type */
DCL &JOBENDSTS *CHAR 1 /* End job request */
/* ------------------------------------------------------------------*/
/* Global message monitor */
MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(SNDERR))
MONMSG MSGID(MCH0000) EXEC(GOTO CMDLBL(SNDERR))
/* ------------------------------------------------------------------*/
/* Test for system shutdown */
/* ------------------------------------------------------------------*/
RTVJOBA JOB(&JOB) USER(&JOBUSER) NBR(&JOBNBR) +
TYPE(&JOBTYPE) ENDSTS(&JOBENDSTS)
IF COND(&JOBENDSTS *EQ '1') THEN(GOTO CMDLBL(ENDPGM))
/* ------------------------------------------------------------------*/
/* Processing loop to receive error messages */
/* ------------------------------------------------------------------*/
BGNEXC: RCVMSG MSGQ(QSYSMSG) WAIT(*MAX) MSG(&MSG) +
MSGDTA(&MSGDTA) MSGID(&MSGID) +
MSGF(&MSGF) MSGFLIB(&MSGFLIB)
/* ------------------------------------------------------------------*/
/* Program start request failed */
IF (&MSGID *EQ 'CPF1269') DO
CHGVAR VAR(&REASONB) VALUE(%SST(&MSGDTA 45 2))
CVTBINDEC FROMBIN(&REASONB) TODEC(&REASOND)
IF ((&REASOND *EQ 704) *OR (&REASOND *EQ 705)) DO
CHGVAR &MODE %SST(&MSGDTA 11 8)
CHGVAR &RMTLOC %SST(&MSGDTA 48 8)
CHGVAR &DEVICE %SST(&MSGDTA 1 10)
ENDMOD RMTLOCNAME(&RMTLOC) MODE(&MODE)
SNDPGMMSG MSGID(&MSGID) MSGF(&MSGFLIB/&MSGF) +
MSGDTA(&MSGDTA) TOMSGQ(QSECOFR)
ENDDO
GOTO BGNEXC
ENDDO
/* ------------------------------------------------------------------*/
/* Device varied off due to QMAXSIGN value exceeded */
IF (&MSGID *EQ 'CPF1397') DO
SNDPGMMSG MSGID(&MSGID) MSGF(&MSGFLIB/&MSGF) MSGDTA(&MSGDTA) +
TOMSGQ(QSYSOPR)
GOTO BGNEXC
ENDDO
/* ------------------------------------------------------------------*/
/* Power outage - Using UPS battery power */
IF (&MSGID *EQ 'CPF1816') DO
ENDWTR *ALL OPTION(*PAGEEND)
ENDSBS QCMN OPTION(*CNTRLD) DELAY(30)
ENDSBS QSPL OPTION(*CNTRLD) DELAY(30)
ENDSBS QINTER OPTION(*CNTRLD) DELAY(90)
GOTO BGNEXC
ENDDO
/* ------------------------------------------------------------------*/
/* Catch all for additional messages - forward to QSYSOPR */
/* ------------------------------------------------------------------*/
SNDPGMMSG MSGID(&MSGID) MSGF(&MSGFLIB/&MSGF) MSGDTA(&MSGDTA) +
TOMSGQ(QSYSOPR)
MONMSG MSGID(CPF0000) EXEC(SNDPGMMSG MSG(&MSG) TOMSGQ(QSYSOPR))
GOTO BGNEXC
/* ------------------------------------------------------------------*/
RETURN: RETURN /* Return to caller */
NEVERDO: CHGVAR VAR(©RIGHT) VALUE(©RIGHT) /* use or lose */
/* ------------------------------------------------------------------*/
/* Forward any error messages */
/* ------------------------------------------------------------------*/
SNDERR:
CALL FWDPGMMSG
SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGTYPE(*ESCAPE) +
MSGDTA('$MONSYSMSG ended in error. See previous messages')
/* ------------------------------------------------------------------*/
ENDPGM: ENDPGM /* End of program specifications */
/* ------------------------------------------------------------------*/
D.BALE@handleman.com wrote:
>
> No such animal.
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.