|
I have another job that monitors subsystem QBATCH on a routine basis and every 15 minutes it sends a message out to a select group of people for each job that is stuck. You could probably modify this to suit your needs. There is some other stuff in there about certain jobs not running that should be that you could trash if you want to.
/*************************************************************************** ***/ /* */ /* Program: GDIQBATCHM */ /* Description: Check Active Jobs in Subsystems */ /* Written by: Douglas W. Turnpaugh of GDS, LLC. */ /* Date: October 20, 1994 */ /* */ /* Modification log: */ /* 11/10/94 by R.Berendt, CDP - GDS, LLC */ /* Changed length of message text from 30 to 80. */ /* 11/11/94 by R.Berendt, CDP - GDS, LLC */ /* Copied program AUD005C from EDIPGM over to GDIQBATCHM */ /* in ROUTINES. Changed it to stop ensuring that certain */ /* jobs were running. Now it will only see if any jobs in */ /* QBATCH are in a MSGW state. */ /* Added parameter of Delay time so this will become a */ /* never ending job. */ /* Ignore QSCHRMT - Search Remote Calendars */ /* 03/11/96 by R.Berendt, CDP - GDS, LLC */ /* Changed size of receiver variable from X'00000076' to */ /* X'0000006F' to prevent program from blowing up on V3R6. */ /* We were suprized that it wasn't blowing up on previous */ /* versions. */ /* */ /* Required objects: */ /* QBATCHMSG *FILE message group */ /* SNDMSGGRP *CMD ROUTINES-(and all objects required by it) */ /* GDIQBATCHM *JOBD Can be added to subsystem QBATCH as an */ /* autostart job. */ /* GDIQBATCHM *CMD A nice way to start this program. */ /* */ /*************************************************************************** ***/ BATCHK: PGM PARM(&DLYTIME) /* VARIABLES USED FOR THE FORMAT */ DCL VAR(&BIN4) TYPE(*CHAR) LEN(4) /* Number of jobs for list job and User + space offset in binary 4 form */ DCL VAR(&DEC8) TYPE(*DEC) LEN(8 0) /* User space offset in decimal 8,0 form */ DCL VAR(&ELEN) TYPE(*DEC) LEN(8 0) /* List job entry length in decimal 8,0 + form */ DCL VAR(&ELENB) TYPE(*CHAR) LEN(4) /* List job entry length in binary 4 form */ DCL VAR(&EUSRSPC) TYPE(*CHAR) LEN(10) /* User space name for command */ DCL VAR(&FORMAT) TYPE(*CHAR) LEN(8) + VALUE('JOBI0200') /* Format Name */ DCL VAR(&INTJOB) TYPE(*CHAR) LEN(16) /* Internal Job Identifier */ /* Indicator Variables for Checking Active Programs */ /* Will be set to Yes if found in the active job list */ DCL VAR(&JN1) TYPE(*CHAR) LEN(1) VALUE('N') DCL VAR(&JN2) TYPE(*CHAR) LEN(1) VALUE('N') DCL VAR(&JN3) TYPE(*CHAR) LEN(1) VALUE('N') DCL VAR(&JN4) TYPE(*CHAR) LEN(1) VALUE('N') DCL VAR(&JN5) TYPE(*CHAR) LEN(1) VALUE('N') DCL VAR(&JN6) TYPE(*CHAR) LEN(1) VALUE('N') DCL VAR(&JOB) TYPE(*CHAR) LEN(10) + VALUE('*ALL ') /* Job Name */ DCL VAR(&JOBI) TYPE(*CHAR) LEN(111) /* Retrieval area for Job Information */ DCL VAR(&JOBNAME) TYPE(*CHAR) LEN(26) /* Job Name - for this job */ DCL VAR(&LJOBE) TYPE(*CHAR) LEN(56) /* Retrieve area fof internal job id */ DCL VAR(&LOOP) TYPE(*DEC) LEN(8 0) /* Number of jobs from list job */ DCL VAR(&MSG) TYPE(*CHAR) LEN(80) DCL VAR(&NUMBER) TYPE(*CHAR) LEN(6) /* Current Job Number */ DCL VAR(&RJOB) TYPE(*CHAR) LEN(10) + /* Job Name from Job list */ DCL VAR(&RUSER) TYPE(*CHAR) LEN(10) + /* User Name from Job list */ DCL VAR(&STAT) TYPE(*CHAR) LEN(4) /* Active Job Status */ DCL VAR(&SUBDESC) TYPE(*CHAR) LEN(10) /* Subsystem Description Name */ DCL VAR(&USER) TYPE(*CHAR) LEN(10) + VALUE('*ALL ') /* User Name */ DCL VAR(&USRSPC) TYPE(*CHAR) LEN(20) + VALUE('CHGA QTEMP ') /* User + Space Name for API's */ DCL VAR(&DLYTIME) TYPE(*DEC) LEN(4 0) /* Number + of seconds to delay job. */ /* Retrieve Job Number */ RTVJOBA NBR(&NUMBER) /* Incorporate Job number into the User Space name */ CHGVAR VAR(%SST(&USRSPC 5 6)) VALUE(&NUMBER) CHGVAR VAR(&EUSRSPC) VALUE(%SST(&USRSPC 1 10)) /* Delete User Space if it already exists */ DLTUSRSPC USRSPC(QTEMP/&EUSRSPC) MONMSG MSGID(CPF0000) MAJORLOOP: /* ROB 11/11/94 */ /* Create User Space */ CALL PGM(QUSCRTUS) PARM(&USRSPC 'WRKACTJOB ' + X'00000100' ' ' '*ALL ' 'WORK ACTIVE + JOB - TEMPORARY USER SPACE ') /* Set Up Jobname */ CHGVAR VAR(%SST(&JOBNAME 1 10)) VALUE(&JOB) CHGVAR VAR(%SST(&JOBNAME 11 10)) VALUE(&USER) CHGVAR VAR(%SST(&JOBNAME 21 6)) VALUE('*ALL ') /* List Active Jobs */ CALL PGM(QUSLJOB) PARM(&USRSPC 'JOBL0100' + &JOBNAME '*ACTIVE ') /* Retrieve the number of entries returned and convert to decimal. */ CALL PGM(QUSRTVUS) PARM(&USRSPC X'00000085' + X'00000004' &BIN4) CHGVAR VAR(&LOOP) VALUE(%BINARY(&BIN4)) /* If number of entries is zero to to NOJOBS label */ IF COND(&LOOP = 0) THEN(GOTO CMDLBL(FINISH)) /* Retrieve List Entry length, convert to decimal. */ /* Retrieve List Entry Offset, Convert to Decimal, and Add one */ /* to set the position. */ CALL PGM(QUSRTVUS) PARM(&USRSPC X'00000089' + X'00000004' &ELENB) CHGVAR VAR(&ELEN) VALUE(%BINARY(&ELENB)) CALL PGM(QUSRTVUS) PARM(&USRSPC X'0000007D' + X'00000004' &BIN4) CHGVAR VAR(&DEC8) VALUE(%BINARY(&BIN4)) CHGVAR VAR(&DEC8) VALUE(&DEC8 + 1) /* Loop for the Number of Jobs until No more jobs then go to */ /* ALLDONE Label. */ STARTLOOP: IF COND(&LOOP = 0) THEN(GOTO CMDLBL(ALLDONE)) /* Convert Decimal position to Binary 4 and retrieve List Job Entry.*/ CHGVAR VAR(%BINARY(&BIN4)) VALUE(&DEC8) CALL PGM(QUSRTVUS) PARM(&USRSPC &BIN4 &ELENB &LJOBE) /* Copy internal job identifier and retrieve job information for */ /* basic performance information. */ CHGVAR VAR(&INTJOB) VALUE(%SST(&LJOBE 27 16)) CALL PGM(QUSRJOBI) PARM(&JOBI X'0000006F' &FORMAT + '*INT ' &INTJOB) MONMSG MSGID(CPF3C51 CPF3C52 CPF3C54 CPF3C55) + EXEC(GOTO CMDLBL(ENDLOOP)) /* Copy Subsystem Name. */ CHGVAR VAR(&SUBDESC) VALUE(%SST(&JOBI 63 10)) /* If the Job is from Subsystem QBATCH then check for CNT300C, */ /* FAXCOMM, FAXSPOOL, GDISPL2, RXM, and RXROUTER for activity, */ IF COND(&SUBDESC = 'QBATCH ') THEN(DO) /* Copy Job Name. */ CHGVAR VAR(&RJOB) VALUE(%SST(&JOBI 9 10)) CHGVAR VAR(&RUSER) VALUE(%SST(&JOBI 19 10)) /* Skip checking for certain active jobs - ROB 11/11/94 */ GOTO CMDLBL(NOSPEC1) IF COND(&RJOB = 'CNT300C') THEN(CHGVAR + VAR(&JN1) VALUE('Y')) IF COND(&RJOB = 'FAXCOMM') THEN(CHGVAR + VAR(&JN2) VALUE('Y')) IF COND(&RJOB = 'FAXSPOOL') THEN(CHGVAR + VAR(&JN3) VALUE('Y')) IF COND(&RJOB = 'GDISPL2') THEN(CHGVAR + VAR(&JN4) VALUE('Y')) IF COND(&RJOB = 'RXM') THEN(CHGVAR + VAR(&JN5) VALUE('Y')) IF COND(&RJOB = 'RXROUTER') THEN(CHGVAR + VAR(&JN6) VALUE('Y')) NOSPEC1: /* ROB 11/11/94 */ /* Ignore Search remote calendars job */ IF COND(&RJOB = 'QSCHRMT') THEN(DO) /* Copy Job Status */ CHGVAR VAR(&STAT) VALUE(%SST(&JOBI 108 4)) IF COND(&STAT = 'MSGW') THEN(DO) CHGVAR VAR(&MSG) VALUE('Job' *BCAT &RJOB *TCAT ', + User' *BCAT &RUSER *TCAT ' has a status + of MSGW waiting in subsystem QBATCH') SNDMSGGRP GROUP(QBATCHMSG) MSGTXT(&MSG) ENDDO /* MSGW */ ENDDO /* QSCHRMT */ ENDDO /* Subsystem = QBATCH */ /* At End of Loop set new decimal position to next entry and */ /* decrement loop counter by one. */ ENDLOOP: CHGVAR VAR(&DEC8) VALUE(&DEC8 + &ELEN) CHGVAR VAR(&LOOP) VALUE(&LOOP -1) GOTO CMDLBL(STARTLOOP) /* Send Message to Group QBATCHMSG if any of the Jobs have a value of */ /* Y. */ ALLDONE: /* Skip checking for certain active jobs - ROB 11/11/94 */ GOTO CMDLBL(NOSPEC2) IF COND(&JN1 = 'N') THEN(SNDMSGGRP GROUP(QBATCHMSG) + MSGTXT('CNT300C is not running in QBATCH')) IF COND(&JN2 = 'N') THEN(SNDMSGGRP GROUP(QBATCHMSG) + MSGTXT('FAXCOMM is not running in QBATCH')) IF COND(&JN3 = 'N') THEN(SNDMSGGRP GROUP(QBATCHMSG) + MSGTXT('FAXSPOOL is not running in QBATCH')) IF COND(&JN4 = 'N') THEN(SNDMSGGRP GROUP(QBATCHMSG) + MSGTXT('GDISPL2 is not running in QBATCH')) IF COND(&JN5 = 'N') THEN(SNDMSGGRP GROUP(QBATCHMSG) + MSGTXT('RXM is not running in QBATCH')) IF COND(&JN6 = 'N') THEN(SNDMSGGRP GROUP(QBATCHMSG) + MSGTXT('RXROUTER is not running in QBATCH')) NOSPEC2: /* ROB 11/11/94 */ /* Delete User Space */ FINISH: DLTUSRSPC USRSPC(QTEMP/&EUSRSPC) MONMSG MSGID(CPF0000) /* ROB 11/11/94 */ DLYJOB DLY(&DLYTIME) GOTO CMDLBL(MAJORLOOP) ENDPGM
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 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.