Another IBM i CL Command that I didn't know about, STRWCH (Start Watch) became useful last month and has been running since. This command allows you to effectively perform a MONMSG command on any job, and perform a task of your choice.
In addition, you may either automatically END the job that evokes the WATCH program or have it continue to its logical conclusion.
For years there has been a bug in the IBM i HTTP Server Powered by Apache. This error is what caused the old RPGIV.com and this midrangeNews.com to be offline in the middle of the night and sometimes in the middle of the day.
That bug is in the MBTOWC C runtime function. Whenever a users with a (I believe it was Tawain) CCSID visited the site, it would cause mbtowc to blow up and effectively kill all the jobs in the HTTP server.
By creating a CL program that traps specific messages that this issue generated, I was able to (A) ignore some of the more benign messages and (B) end and restart the HTTP server, cleaning up the issue.
While I would prefer IBM fix this issue, this is a great work around for me as the website has been consistenly up for several weeks. Something it hasn't been able to do since V4R2 when I started running it on the original i5 OS HTTP Server (pre-Apache era).
CL Command Related to Watch: GO CMDWCH
The user written Exit program's parameter list is documented in the Info center here.
Here's an example of starting a Watch:
STRWCH SSNID(*GEN) WCHPGM(MYLIB/MYPGM) WCHMSG( (msg1234) (msg5678) (CPF98*)) JOB((*ALL/JOBNAME/USRPRF))
In your Exit Program, you may want to only continue processing your exit program when the first parameter is *MSGID. If some other issue occurs, be sure you've read and understand what that condition means and proceed accordingly.