Use the corresponding commands to set up and
use the watch for event function.
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, you must 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, you
must 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.
The Work with Watches (WRKWCH) command is used to show a panel with a list of active watches on the system.
The Start Watch (QSCSWCH) and End Watch (QSCEWCH) application programming interfaces (APIs) have a very similar usage to the STRWCH and ENDWCH 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 monitoring traces. For more information, see Advanced trace function: Watch support.