Using the watch for event function
To set up and use the watch for event function, use the corresponding commands.
Start Watch command
The Start Watch (STRWCH) command starts a watch session and notifies you when the specified message or Licensed Internal Code log entry occurs. When the watched for message is added to the specified message queue or log, or the watched-for log entry is added, the exit program specified in the Watch program (WCHPGM) parameter is called.
When watching for messages, specify the message queue or job log where you expect the message to be sent. You can narrow the search by specifying a text string to be compared against the message data, the From program or the To program of the watched for message.
When watching for Licensed Internal Code log entries, specify the Licensed Internal Code log major and minor codes. *ALL and wildcards (?) are accepted. You can narrow the search by specifying a text string to be compared against several of the Licensed Internal Code log fields of the watched for log entry. Use the Watch for Licensed Internal Code log entry (WCHLICLOG) parameter on the STRWCH command.
Work with Watches command
The Work with Watches (WRKWCH) command is used to show a panel with a list of active watches on the system.
End Watch command
The End Watch (ENDWCH) command is used to end a watch session.
Start Watch and End Watch APIs
The Start Watch (QSCSWCH) and End Watch (QSCEWCH) APIs have a very similar usage to the STRWCH and ENDWCH commands.
Using the watch for event function with trace commands
Watch support enhances the trace functions by automatically monitoring and ending traces when certain predetermined criteria are met. This prevents the loss of valuable trace data and reduces the amount of time that you need to spend in monitoring traces.
Parent topic:
Watch for event function