Midrange News for the IBM i Community

Posted by: Bob Cozzi
Rogue Programmer
Cozzi Productions, Inc.
Start Watch (STRWCH) Command Became Useful
has no ratings.
Published: 16 Jan 2015
Revised: 16 Jan 2015 - 3415 days ago
Last viewed on: 20 May 2024 (5259 views) 

Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.

Start Watch (STRWCH) Command Became Useful Published by: Bob Cozzi on 16 Jan 2015 view comments

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:

WCHMSG( (msg1234) (msg5678) (CPF98*)) 

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.

Return to midrangenews.com home page.
Sort Ascend | Descend