contact image

    Monitor WRKACTJOB for jobs in Message Wait (*MSGW)

    This example creates a list of all jobs on the system by getting a list from the WRKACTJOB command. It should be submitted thru the job scheduler to run. It currently starts at 0500 and ends at 1800. This can be changed by modifiying the variables starttime & endtime. When it finds an error it loops thru a list of userid's and sends a break message to every device that the user is signed on. It will then wait five (5) minutes before resending this message. (give you some time to fix the error)
    Once again modifications are encouraged and Please send back new version and I will place your modification mark on the source and the website.

    OBJECTS MSC50 RPGLE Monitor program

    API’s USED
    QUSLJOB    - List jobs
    QUSCRTUS   - Create user space
    QUSCUSAT   - Change userspace
    QCMDEXC    - Run CLP commands in RPG

Download text files

Replace these userid's with yours
     c                   do        2             x
     c                   select
     c                   When      X = 1.
     c                   Eval      OutUSer = 'FLANARY'
     c                   When      X = 2.
     c                   Eval      OutUSer = 'SOMEUSER'
     c                   endsl
You may also ignor jobs that are always in *MSGW by placing them here in the code
      *  Get the device (*ACTIVE) for the userid and send break message
     c                   if        %subst(XTEMP:4:10) <> 'MSC18#3' and
     c                             %subst(XTEMP:4:10) <> 'MSC18#4'