Extend the watch function using the watch exit program example

Using the example exit program as a starting point, you can modify the code to allow the program to perform additional function.

The following table provides suggestions for ways you can extend the capability of the watch function on your system by performing different actions based on the Trace option setting parameter in the exit program. Refer to each Trace option setting parameter value and the corresponding sample functions that can be performed.

Trace option setting parameter value Sample functions that can be performed
*ON
  • To set up the environment right before the trace starts. For example:
    • Start a process
    • Run commands
    • Change some special values
  • To register the status of the system right before the trace starts. For example:
    • Retrieve system values
    • Dump a job
    • Dump key objects for problem analysis
  • To verify that everything is ready for the trace and the watch function to start. For example:
    • Check certain system values
    • Check for the existence of key objects.
    If the exit program detects that something is not ready, the value *STOP for the Output parameter could be specified to prevent the trace command and the watch function from starting.
*MSGID or *LICLOG
  • To register the final status of the system right after the event being watched for occurs. For example:
    • Retrieve system values
    • Dump a job
    • Dump key objects for problem analysis
  • To set the environment back to the initial status. For example:
    • End a process
    • Run commands
    • Change special values
*COMPDATA The exit program can determine whether the trace and the watch function should stop or continue running. This is determined by returning *STOP or *CONTINUE for the Output parameter.
*INTVAL
  • To perform activities periodically. For example, dump key objects for problem analysis.
  • To check conditions periodically. For example, check for the existence of key objects. The exit program can determine whether the trace and the watch function should stop or continue running. This is determined by returning *STOP or *CONTINUE for the Output parameter.
*WCHTIMO To set the environment back to the initial status. For example:
  • End a process
  • Run commands
  • Change some special values
Related reference
Example: Watch exit program