WATCH_INFO view

The WATCH_INFO view returns information about watch sessions on the system.

The values returned for the columns in the view are closely related to the values returned by the WRKWCH (Work with Watches) CL command and by the Retrieve Watch List (QSCRWCHL) and Retrieve Watch Information (QSCRWCHI) API.

Authorization: The caller must have:
  • *USE authority to the QSYS/QSCRWCHL and QSYS/QSCRWCHI programs, and
    • *SERVICE special authority, or
    • Authorization to the QIBM_SERVICE_WATCH and QIBM_SERVICE_TRACE function usage identifiers.

The following table describes the columns in the view. The system name is WATCH_INFO. The schema is QSYS2.

Table 1. WATCH_INFO view
Column Name System Column Name Data Type Description
SESSION_ID SESSION_ID VARCHAR(10) The session identifier for the watch.
ORIGIN ORIGIN VARCHAR(9) The name of the command or the API that started the watch.
QSCSWCH
Session started by Start Watch (QSCSWCH) API.
STRCMNTRC
Session started by Start Communications Trace (STRCMNTRC) command.
STRTRC
Session started by Start Trace (STRTRC) command.
STRWCH
Session started by Start Watch (STRWCH) command.
TRCCNN
Session started by Trace Connection (TRCCNN) command.
TRCINT
Session started by Trace Internal (TRCINT) command.
TRCTCPAPP
Session started by Trace TCP/IP Application (TRCTCPAPP) command.
ORIGIN_JOB ORIGIN_JOB VARCHAR(28) The qualified job name that started the watch session.
START_TIMESTAMP WCH_START TIMESTAMP The timestamp of when the watch was started.
USER_ID USER_ID VARCHAR(10) The name of the user that started the watch session.
WATCH_SESSION_TYPE WCH_TYPE VARCHAR(7) Identifies the type of watch according to its origin.
*SRVMON
Watch session started using the Service Monitor function of the operating system.
*STRWCH
Watch session started using the Start Watch (STRWCH) command or Start Watch (QSCSWCH) API.
*TRCCMD
Watch session started using Start Communications Trace (STRCMNTRC), Start Trace (STRTRC), Trace Internal (TRCINT), Trace Connection (TRCCNN), or Trace TCP/IP Application (TRTCPAPP) commands.
STATUS STATUS VARCHAR(6) The status of the watch session.
ACTIVE
Session is in ACTIVE status
ENDING
Session is in ENDING status
JOB_RUN_PRIORITY PRIORITY INTEGER The priority for the job where the watch session work will be run.
WATCHED_MESSAGE_COUNT MSG_COUNT INTEGER The number of messages being watched.
WATCHED_LIC_LOG_COUNT LIC_COUNT INTEGER The number of LIC logs being watched.
WATCHED_PAL_COUNT PAL_COUNT INTEGER The number of PALs being watched.
WATCH_PROGRAM_LIBRARY WCH_PGMLIB VARCHAR(10)
Nullable
The name of the library where the watch program is located.

Contains the null value if WATCH_PROGRAM is null.

WATCH_PROGRAM WCH_PGM VARCHAR(10)
Nullable
The name of the program called to notify that a specified watch event occurred.

Contains the null value if a watch program is not specified or not found.

WATCH_PROGRAM_CALL_START CALL_START VARCHAR(3)
Nullable
Whether the watch program will be called before starting watching for any event.
NO
The watch program will not be called before starting watching for any event.
YES
The watch program will be called before starting watching for any event.

Contains the null value if WATCH_PROGRAM is null.

WATCH_PROGRAM_CALL_END CALL_END VARCHAR(3)
Nullable
Whether the watch program will be called when the watch session is ending.
NO
The watch program will not be called when the watch session is ending.
YES
The watch program will be called when the watch session is ending.

Contains the null value if WATCH_PROGRAM is null.

TIME_LIMIT TIME_LIMIT INTEGER
Nullable
The time limit, in minutes, for watching for a message, a LIC log entry, or a PAL entry. A non-null value is only returned for watch sessions started by a trace command.

When the specified amount of time has elapsed, the program identified by the WATCH_PROGRAM column is called, the watch is ended, and message CPI3999 is sent to the history log.

Contains the null value if the watch session was started by a trace command and did not specify a time limit or for sessions not started by a trace command.

TIME_INTERVAL INTERVAL INTEGER
Nullable
The interval of time, in seconds, of how often the trace exit program is called.

Contains the null value if the watch session was started by a trace command and did not specify an interval or for sessions not started by a trace command.

Example

  • List all the service monitor watches that are currently active.
    SELECT *
      FROM QSYS2.WATCH_INFO 
      WHERE WATCH_SESSION_TYPE = '*SRVMON' AND
            STATUS = 'ACTIVE';