Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.
The iQuery.watchList() UDTF returns one row for each watch.
The information returned in similar to the WRKWCH command.
UDTF | Return Type | Description |
watchList | TABLE | Returns a resultSet containing information about the active Watches. |
iQuery.watchList( watch_type, Origin, session_user, watchStatus, session_ID )
All parameters are optional and default to *ALL.
The watch_Type is the Watch Session Type. This equates to the WCH (Watch) Parameter of the WRKWCH CL command. The valid chocies are *ALL (the default), *SRVMON, *STRWCH, or *TRCCMD.
The Origin is the original of the watch. It is similar to the Watch_Type paramter but gives you more granular options. The valid choices are *ALL (the default), QSCSWCH, STRWCH, STRTRC, STRCMNTRC, TRCINT, TRCCNN, and TRCTCPAPP. Leading * asterisk may be specified and is ignored.
The session_User is the User Profile of the user who started the Watch Session. The valid choices are *ALL (the default), * or *CURRENT (current user), or a specific user profile name.
The watchStatus is the current status of the watch session. The valid choices are *ALL (the default), *ACTIVE (the sesion is active) or *ENDING (the session is currently ending). Note the leading * asterisk is optional.
The session_ID is the session identifier assigned to the watch. This parameter may be *ALL (the default), a generica session ID, or a specific session ID.
Column | Type | Description |
SESSIONID | varchar(10) | The Watch Session ID. |
WATCHTYPE | varchar(10) | The type of watch (*SRVMON, *STRWCH, *TRCCMD) |
ORIGIN | varchar(10) | The Command or API used to create the watch. |
STARTED_BY_USER | varchar(10) | The User Profile of the User who created the watch. |
STATUS | varchar(10) | Watch Status (ACTIVE or ENDING) |
WATCH_PGM | varchar(10) | Program to call on watch events. |
WATCH_PGMLIB | varchar(10) | Library name for Program to call on watch events. |
JOBNAME | varchar(10) | The job name for the watch job. |
JOBUSER | varchar(10) | The job user for the watch job. |
JOBNBR | varchar(6) | The job number for the watch job. |
start_date | date | The date the watch was started. |
start_time | time | The time the watch was started. |
msgWatched | integer | Number of messages being watched. |
MSGID | char(7) | The message ID of the first message being watched. |
MSGTYPE | varchar(10) | The message type of the first message being watched. |
MSGSEV | smallint | The message severity of the first message being watched. |
MSGQ | varchar(10) | The message queue name of the first message being watched. |
MSGQLIB | varchar(10) | The message queue library of the message queue of the first message being watched. |
WATCHED_JOBNAME | varchar(10) | The Job name of the job being watched. |
WATCHED_JOBUSER | varchar(10) | The User Profile of the job being watched. |
WATCHED_JOBNBR | varchar(6) | The Job number of the job being watched. |
CALLOPTIONS | varchar(32) | An array of the Options that identify additional times when the Called Watch Program is called. |
select * from table( iQuery.watchList() ) wl;
This creates a list of all active watches.