10 pts.
 How to monitor job activity on AS/400
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.

Software/Hardware used:
ASKED: November 18, 2008  1:41 PM
UPDATED: November 21, 2008  2:20 PM

Answer Wiki:
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) <a href="http://www.brucevining.com/">Bruce Vining Services</a> Try wrksysact and press F19
Last Wiki Answer Submitted:  November 21, 2008  2:20 pm  by  bvining   6,055 pts.
All Answer Wiki Contributors:  bvining   6,055 pts. , philpl1jb   44,220 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _