How to monitor job activity on AS/400

10 pts.
How is it possible to tell on AS/400 that the program (RPG) is just "idling" on the screen and the user is not really using it ? I need the way to monitor it to end the job if the program is not being used.

Answer Wiki

Thanks. We'll let you know when a new response is added.

wrkActJob Status DSPW display waiting – at this instant the job is waiting for response from screen
Option 5 work with job
option 11 call stack – if F5 doesn’t show a different statement number job may be idling
optin 14 display open files
F11 Display I/O details
F5 – refresh
if I/O count and relative record don’t change job may be idling
option 3 Job run attributes
CPU time used shouldn’t be increasing or is increasing very slowly


An alternative, and automated, approach would be to use the Retrieve Job Information API QUSRJOBI. Format JOBI0200 provides the Number of interactive transactions and the Processing unit time used by the job. You could periodically (every 15 minutes?) have a program wake up and retrieve this information about the specific job of interest. This job would compare the current Number of interactive transactions to the last Number of interactive transactions and, if the same, then compare the current Processing time used to the last Processing time used. If the same, end the job. If not the same, move current to last for both values and go back to sleep.

If you are interested not so much with a specific job but any interactive job, then you could also use the List Job API QUSLJOB to get a listing of every interactive job on the system. Using this list you could then have the same logic applied to each job.

In addition to the above you may want to consider a few other items (all of which can be done within a program). Some that come to mind are:

  1. Is the job in a message wait condition with the message on another queue?
  2. Has the user used system request to start a secondary job and the user is active in the other job?

Obviously there is a risk involved in terminating jobs after any fixed length of time. With phone calls I have certainly been known to leave an active transaction in process for the length of the call and whatever work came out of the call. Perhaps though you’re thinking of doing this type of operation after normal business hours.

Bruce Vining (who has written many programs of this nature in the past)

Try wrksysact and press F19

Discuss This Question:  

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: