Watching for messages
The system provides a watch-for-event function that allows you to watch for messages.
Use the Start Watch (STRWCH) command to start a watch session and be notified when a specified message occurs. When the watched-for message is added to the specified message queue or log, the watch exit program is called. The watch exit program runs in a job in the QUSRWRK subsystem.
The Work with Watches (WRKWCH) command can be used to show a panel with the list of active watches on the system. The End Watch (ENDWCH) command can be used to end watch sessions.
The Start Watch (QSCSWCH) and End Watch (QSCEWCH) APIs have a similar usage to the STRWCH and ENDWCH commands.
The Retrieve Watch Information (QSCRWCHI) and Retrieve Watch List (QSCRWCHL) APIs can be used to obtain information about watches.
The watch for event function is also incorporated into some trace commands:
- Start Trace (STRTRC)
- Start Communications Trace (STRCMNTRC)
- Trace Internal (TRCINT)
- Trace Connection (TRCCNN)
- Trace TCP Application (TRCTCPAPP)
Watch support enhances the trace functions by automatically monitoring and ending traces when certain predetermined criteria are met. Using watch support can prevent the loss of valuable trace data and reduce the amount of time you need to spend monitoring traces.