jobq monitor - IBM AS400

This is a discussion on jobq monitor - IBM AS400 ; Hi. Is there a tool which can check all jobques and send an email if any job runs longer than let's say 60 minutes? Regards, Tomasz...

+ Reply to Thread
Results 1 to 4 of 4

Thread: jobq monitor

  1. jobq monitor

    Hi.
    Is there a tool which can check all jobques and send an email if any job
    runs longer than let's say 60 minutes?


    Regards,
    Tomasz

  2. Re: jobq monitor

    Hi Tomasz

    I'm not aware of any free ones but I know a number of folks who
    convert the contents of DSPLOG to a file then process it either on or
    off the iSeries and generate the email for jobs that run outside of
    spec.

    Do you have any programing skills (iSeries or otherwise) in house?

    Cheers, Brad


  3. Re: jobq monitor

    Hi.

    Unfortunatelly my programming skills are still very poor.
    I only 'do' some things in CL but is not enough.
    I have few colegues who program in RPG, perhaps I can talk to them.

    Regards,
    Tomasz



    Brad pisze:
    > Hi Tomasz
    >
    > I'm not aware of any free ones but I know a number of folks who
    > convert the contents of DSPLOG to a file then process it either on or
    > off the iSeries and generate the email for jobs that run outside of
    > spec.
    >
    > Do you have any programing skills (iSeries or otherwise) in house?
    >
    > Cheers, Brad
    >


  4. Re: jobq monitor

    Hi Tomasz,

    I haven't got a method of checking all job queues, but I have used the
    following CL code to submit a backup job and ensure it doesn't run
    longer than a specified time. Obviously, this only works for
    individual jobs, but you may be able to modify it for your
    requirements.

    Hope it helps.

    /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
    */
    /* PROGRAM : SBMBCKUPW
    */
    /* TITLE : Submit Backup [& Wait for Completion]
    */
    /* SYSTEM : General
    */
    /* AUTHOR : xxxxxxxxxxxxx
    */
    /* DATE : January 2004
    */
    /* NOTES : Submits the backup job then waits for a completion
    */
    /* : message. If the completion message is not received in
    */
    /* : a specified time, the backup job is terminated.
    */
    /* : This prevents the backup job running over and causing
    */
    /* : other jobs to fail due to file and/or record locks.
    */
    /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
    */
    PGM PARM(&BckUpOpt &Dev &EndOpt &RunTime &JobQueue)

    DCL VAR(&BckUpOpt) TYPE(*CHAR) LEN(8)
    DCL VAR(&Dev) TYPE(*CHAR) LEN(10)
    DCL VAR(&EndOpt) TYPE(*CHAR) LEN(7)
    DCL VAR(&RunTime) TYPE(*CHAR) LEN(6)
    DCL VAR(&JobQueue) TYPE(*CHAR) LEN(10)

    DCL VAR(&RunTimeDec) TYPE(*DEC) LEN(6 0)
    DCL VAR(&MsgData) TYPE(*CHAR) LEN(26)
    DCL VAR(&MsgID) TYPE(*CHAR) LEN(7)
    DCL VAR(&MsgTxt) TYPE(*CHAR) LEN(132)
    DCL VAR(&JobName) TYPE(*CHAR) LEN(10)
    DCL VAR(&JobUser) TYPE(*CHAR) LEN(10)
    DCL VAR(&JobNbr) TYPE(*CHAR) LEN(6)

    /************************************************** *********/
    /* Check Backup Control message queue exists */
    /************************************************** *********/

    CHKOBJ OBJ(QUSRSYS/BCKUPCTL) OBJTYPE(*MSGQ)
    MONMSG MSGID(CPF9801) EXEC(DO)
    CRTMSGQ MSGQ(QUSRSYS/BCKUPCTL) +
    TEXT('Backup Control Message Queue') +
    /* MSGQFULL(*WRAP) */
    MONMSG MSGID(CPF0000) EXEC(DO)
    CHGVAR VAR(&MsgTxt) +
    VALUE('Failed to create backup message
    queue')
    GOTO CMDLBL(MSGEXT)
    ENDDO
    ENDDO

    /************************************************** *********/
    /* Clear Backup Control message queue */
    /************************************************** *********/

    CLRMSGQ MSGQ(QUSRSYS/BCKUPCTL)
    MONMSG MSGID(CPF0000) EXEC(DO)
    CHGVAR VAR(&MsgTxt) +
    VALUE('Failed to clear backup message queue')
    GOTO CMDLBL(MSGEXT)
    ENDDO

    /************************************************** *********/
    /* Validate specified run-time */
    /* Minimum 30 minutes (1800 seconds), */
    /* Maximum 5 hours (18000 seconds), */
    /************************************************** *********/

    CHGVAR VAR(&RunTimeDec) VALUE(&RunTime)
    MONMSG MSGID(CPF0000) EXEC(DO)
    CHGVAR VAR(&RunTimeDec) VALUE(0)
    ENDDO

    IF COND((&RunTimeDec *LT 1800) *OR +
    (&RunTimeDec *GT 18000)) THEN(DO)
    CHGVAR VAR(&MsgTxt) +
    VALUE('Invalid backup run-time specified')
    GOTO CMDLBL(MSGEXT)
    ENDDO

    /************************************************** *********/
    /* Check Job Queue exists */
    /************************************************** *********/

    CHKOBJ OBJ(*LIBL/&JobQueue) OBJTYPE(*JOBQ)
    MONMSG MSGID(CPF9801) EXEC(DO)
    CHGVAR VAR(&MsgTxt) +
    VALUE('Unable to access backup job queue')
    GOTO CMDLBL(MSGEXT)
    ENDDO

    /************************************************** *********/
    /* Submit backup-job specifying message queue */
    /************************************************** *********/

    RTVJOBA JOB(&JobName)
    SBMJOB CMD(CALL PGM(RUNBACKUPC) +
    PARM(&BckUpOpt &Dev &EndOpt)) +
    JOB(&JobName) +
    JOBQ(*LIBL/&JobQueue) +
    MSGQ(QUSRSYS/BCKUPCTL)
    MONMSG MSGID(CPF0000) EXEC(DO)
    CHGVAR VAR(&MsgTxt) +
    VALUE('Failed to submit backup job')
    GOTO CMDLBL(MSGEXT)
    ENDDO

    /************************************************** *********/
    /* Retrieve submitted job details; NAME/USER/NUMBER */
    /* (in case we need to terminate it) */
    /************************************************** *********/

    RCVMSG MSGTYPE(*LAST) MSGDTA(&MsgData)
    CHGVAR VAR(&JobName) VALUE(%SST(&MsgData 1 10))
    CHGVAR VAR(&JobUser) VALUE(%SST(&MsgData 11 10))
    CHGVAR VAR(&JobNbr) VALUE(%SST(&MsgData 21 6))

    /************************************************** *********/
    /* Wait [up to specified time] for completion message */
    /************************************************** *********/

    RCVMSG MSGQ(QUSRSYS/BCKUPCTL) MSGTYPE(*COMP) +
    WAIT(&RunTimeDec) RMV(*NO) MSG(&MsgTxt) +
    MSGID(&MsgID)
    MONMSG MSGID(CPF0000)

    /************************************************** *********/
    /* If no completion message received, terminate backup job */
    /************************************************** *********/

    IF COND(&MsgID *EQ ' ') THEN(DO)
    ENDJOB JOB(&JobNbr/&JobUser/&JobName) OPTION(*IMMED)
    MONMSG MSGID(CPF0000)
    CHGVAR VAR(&MsgTxt) +
    VALUE('Backup not completed within time limit.
    +
    Job terminated')
    GOTO CMDLBL(MSGEXT)
    ENDDO

    /************************************************** *********/
    /* Pass back any message (including completion messages) */
    /************************************************** *********/

    MSGEXT: SNDPGMMSG MSGID(CPF9897) MSGF(QCPFMSG) MSGDTA(&MsgTxt) +
    TOPGMQ(*PRV) TOMSGQ(*SYSOPR) MSGTYPE(*INFO)
    MONMSG MSGID(CPF0000)

    EXTPGM: RETURN
    ENDPGM

+ Reply to Thread