Quite some time ago, I wrote the blog IBM i 7.1: Jobs Exceeding Their CPU or Storage Limits are Now Held. Earlier this year, the question was asked: “Hi, What if we WANT the job to end if it exceeds the max CPU? Can this be specified in the class?” I try to respond to most of the questions that are asked and this blog article provides an answer to that comment.
As was written in the referenced blog, PTFs in 7.1 changed the behavior of the system when jobs exceed their maximum CPU or maximum temporary storage limits; rather than being ended, the jobs are held and the following messages are sent to QSYSOPR:
- CPI112D – Job held by the system, CPUTIME limit exceeded
- CPI112E – Job held by the system, MAXTMPSTG limit exceeded
Holding of jobs when these limits are hit is also the behavior in the IBM i 7.2 release.
However, some users still want the jobs to be automatically ended when these conditions occur and not have to manually manage jobs that have exceeded their limits.
You can accomplish this is by using your favorite message monitoring solution to automatically monitor for the messages that are sent when CPU or temporary storage limits have been reached. You can do this with Management Central Message Monitors or the Message Monitors added to Navigator in 7.2. There are also a variety of message monitoring solutions provided by vendors other than IBM.
Another way is to use watches, which would be my preferred method. Why? I simply love message watches for solutions such as this because they are extremely efficient in their implementation and relatively easy to set up. Read the blog Automate Monitoring with Watches if you are not familiar with them.
You can set up a watch to monitor for the above messages. When the message is sent to QSYSOPR, your watch program will run and your program determines the action that is taken. To get the old behavior back you simply end the job; your watch program will be passed the message replacement text that identifies the affected job. Watch programs can be as sophisticated as you need — you can check for specific job names and selectively end ones you know you always want to end, but other jobs could remain held for manual management.
The IBM support article Jobs are Held Instead of ended CPI112D and CPI112E (How to revert back) has an example watch program along with instructions on how to set up the watch.
This blog post was edited to fix broken links on April 11, 2020.
This blog post was originally published on IBMSystemsMag.com and is reproduced here by permission of IBM Systems Media.