Run Your Watch Definitions and Create a Watch Event Exit Program

APIs by Example.

In the previous installment of APIs by Example, I discussed the concept of watches introduced with release 5.4. Watches let you define a set of conditions identifying a specific system event, in turn causing a watch event exit program to be called. In a user-written exit program, you can optionally perform the actions prompted by the watch event, such as forwarding an email reporting the event, collecting event data, and running appropriate system commands. Alternatively, you can specify the QPDETWCH system watch program, which takes the information supplied to the watch exit program, generates an XML service request, and places that service request on the Service Monitor queue.

Last time, I presented my new Add Watch Definition (ADDWCHDFN) and Remove Watch Definition (RMVWCHDFN) commands. Creating a watch definition lets you save the watch attributes in a table and easily restart the watch following an IPL or an issued End Watch (ENDWCH) command. Here, I offer the Start Watch Definition (STRWCHDFN) command used to activate a previously created watch definition. I also present examples of how to write and take advantage of watch event exit programs, and include a skeleton exit program that you can use as a starting point for writing your own watch event exit programs for system-monitoring or message-forwarding purposes

Download the save file containing the source code.

Read the entire article.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s