1 | Session ID | Input | Char(10) |
2 | Started session ID | Output | Char(10) |
3 | Watch program | Input | Char(20) |
4 | Watch for message | Input | Char(*) |
5 | Watch for LIC log entry | Input | Char(*) |
6 | Error Code | I/O | Char(*) |
The Start Watch (QSCSWCH) API starts the watch for event function, which notifies the user by calling a user specified program when the specified event (a message or LIC log) occurs.
Up to 10000 watch sessions can be active at a time. The watch session continues until ended with the End Watch (QSCEWCH) API or with the End Watch (ENDWCH) command.
Note: A watch session can be ended from the same job or a different job.
If you specify *ALL for the watched job name, or a generic user name, you must have all object (*ALLOBJ) special authority, or be authorized to the Watch any job function of Operating System through iSeries Navigator's Application Administration support. The Change Function Usage (CHGFCNUSG) command, with a function ID of QIBM_WATCH_ANY_JOB, can also be used to change the list of users that are allowed to start and end watch operations.
The session identifier for this watch. This watch session identifier must be unique across all active watche sessions on the system. You cannot specify a session identifier that starts with "QSC". You can use this special value for this parameter:
*GEN | The system will generate a unique session identifier for this watch that will be returned as output in Started session ID parameter. |
The identifier of the watch session just started.
The program to be called to notify that a specified watch event occurred. The watch program will be called after a match of a message identifier and any associated comparison data specified for the watch for message parameter, or a match of a Licensed Internal Code (LIC) log entry and any associated comparison data specified for the watch for LIC log entry parameter occurs.
The exit program will be called once for each message id and LIC log entry specified on this API. That is, if a message is watched on a message queue and in a job log, and the message is sent to both locations, the exit program will be called twice.
For more information about the watch exit program interface, refer to the System API Reference information in the iSeries Information Center at http://www.iseries.ibm.com/infocenter .
The information must be in the following format:
*LIBL | All libraries in the job's library list are searched until the first match is found. |
*CURLIB | The current library for the job is used to locate the program. If no library is specified as the current library for the job, the QGPL library is used. |
The message identifiers which are to be watched for and where to watch for them. The information must be in the following format:
The licensed internal code (LIC) log entry identifiers which are to be watched for. The watched for condition will be met if a LIC log entry is added that matches the specified major and minor codes and any comparison data specified. The information must be in the following format:
The structure in which to return error information. For the format of the structure, see Error Code Parameter.
The following table shows the format for the messages to be watched for. For a detailed description of each field, see Field Descriptions.
Offset | Type | Field | |
---|---|---|---|
Dec | Hex | ||
0 | 0 | BINARY(4) | Length of message information |
4 | 4 | CHAR(7) | Message id |
11 | B | CHAR(1) | Reserved |
12 | C | CHAR(10) | Watched message queue name |
22 | 16 | CHAR(10) | Watched message queue library |
32 | 20 | CHAR(10) | Watched job name |
42 | 2A | CHAR(10) | Watched job user name |
52 | 34 | CHAR(6) | Watched job number |
58 | 3A | CHAR(6) | Reserved |
64 | 40 | BINARY(4) | Offset to message comparison data |
68 | 44 | BINARY(4) | Length of message comparison data |
72 | 48 | CHAR(10) | Compare against |
82 | 52 | CHAR(*) | Message comparison data |
The following table shows the format for the LIC logs to be watched for. For a detailed description of each field, see Field Descriptions.
Offset | Type | Field | |
---|---|---|---|
Dec | Hex | ||
0 | 0 | BINARY(4) | Length of LIC log information |
4 | 4 | CHAR(4) | LIC log major code |
8 | 8 | CHAR(4) | LIC log minor code |
12 | C | BINARY(4) | Offset to LIC log comparison data |
16 | 10 | BINARY(4) | Length of LIC log comparison data |
20 | 14 | CHAR(*) | LIC log comparison data |
Compare against. The part of the message the data specified in message comparison data field is to be compared against. You must specify blanks if zero was specified for the length of message comparison data field. You can specify the following special values for this field:
*MSGDTA | The message comparison data will be compared against the message replacement data. |
*FROMPGM | The message comparison data will be compared against the name of the program sending the message, or the name of the ILE program that contains the procedure sending the message. |
*TOPGM | The message comparison data will be compared against the name of the program the message was sent to, or the name of the ILE program that contains the procedure the message was sent to. |
Length of LIC log comparison data. The length of the text specified in LIC log comparison data field. Valid values are 0 through 72.
Length of LIC log information. The length of the structure containing the information of the LIC log to watch for.
Length of message comparison data. The length of the text specified in message comparison data field. Valid values are 0 through 72.
Length of message information. The length of the structure containing the information of the message to watch for.
LIC log comparison data. The comparison data to be used if a log entry matching the specified major and minor codes is added to the licensed internal code (LIC) log. If this text is found in the LIC log entry data fields of the watched for log entry, the watched for condition is true. This text is case sensitive. The LIC log fields which can be compared are TDE number, task name, server type, job name, user ID, job number, thread ID, exception ID, LIC module compile binary timestamp, LIC module offset, LIC module RU name, LIC module name, LIC module entry point name. The comparison data cannot be used to match across two fields, and can match an entire field or a substring of any field. When watching for an exception ID, all four hexadecimal digits of the exception ID must be specified. Also, the prefix MCH may be specified if you want to compare only against the exception ID field and avoid possible substring matches with the other fields.
LIC log major code. The LIC log major code to be watched for. You can specify either a hexadecimal digit or a question mark for each character in the four-digit code. A question mark is a wildcard character that will match any digit in that position. Up to three wildcard characters can be specified. You can specify the following special value for this field:
*ALL | Any LIC log entry major code will be considered to be a match. If *ALL is specified for the major code, you cannot specify *ALL for the LIC log entry minor code. |
LIC log minor code. The LIC log minor code to be watched for. You can specify either a hexadecimal digit or a question mark for each character in the four-digit code. A question mark is a wildcard character that will match any digit in that position. Up to three wildcard characters can be specified. You can specify the following special value for this field:
*ALL | Any LIC log entry minor code will be considered to be a match. If *ALL is specified for the minor code, you cannot specify *ALL for the LIC log entry major code. |
Message comparison data. The comparison data to be used if a message matching the specified message ID is added to the specified message queue or log. If the message data, the "From program" or the "To program" includes the specified text, the watched for condition is true. This text is case sensitive.
Message id. The 7-character message identifier to be watched for.
Offset to LIC log comparison data. The offset to the field that holds the LIC log comparison data.
Offset to message comparison data. The offset to the field that holds the message comparison data.
Reserved. A reserved field. This field must be set to hexadecimal or binary zero.
Watched job name. The name of the job to be watched. You must specify blanks if something different from *JOBLOG is specified for watched message queue name field. You can specify the following special values for this field:
generic-name | The generic name of the job to be watched. A generic name is a character string of one or more characters followed by an asterisk (*); for example, ABC*. The asterisk substitutes for any valid characters. A generic job name specifies all jobs with job names that begin with the generic prefix. |
* | Only the job log of the job that issued this API is watched. |
*ALL | All jobs with the specified job user name are watched. *ALL for the job name is considered to be a generic job specification because it will watch all jobs that meet the job user name qualifier that you specified. |
Watched job number. The job number (000001-999999) to further qualify the job name and user name. You must specify blanks if a generic job name or a generic user name qualifier is specified, or if something different from *JOBLOG is specified for watched message queue name field. You can specify the following special value for this field:
*ALL | All jobs with the specified job name and user name are watched. |
Watched job user name. The user name of the job to be watched. You must specify blanks if '*' is specified for the watched job name field or something different from *JOBLOG is specified for watched message queue name field. You can specify the following special value for this field:
generic-name | The generic name of the user name of the job to be watched. A generic name is a character string of one or more characters followed by an asterisk (*); for example, ABC*. The asterisk substitutes for any valid characters. A generic user name specifies all jobs with the specified job name and with user names that begin with the generic prefix. |
*ALL | All jobs with the specified job name are watched. *ALL for the job user name is considered to be a generic job specification because it will watch all jobs that meet the job name qualifier that you specified. |
Watched message queue library. The name of the library where the message queue is located. This field is ignored if *SYSOPR, *JOBLOG or *HSTLOG was specified in the message queue name. You can specify the following special value for this field:
*LIBL | All libraries in the job's library list are searched until the first match is found. |
Watched message queue name. The name of the message queue to watch. You can specify the following special values for this field:
*SYSOPR | Watch messages added to the system operator message queue (QSYSOPR message queue in library QSYS). |
*JOBLOG | Watch messages added to the job logs of the jobs specified for the watched job field. |
*HSTLOG | Watch messages added to the history log (QHST message queue in library QSYS). |
The following messages may be sent from this function:
Message ID | Error Message Text |
---|---|
CPF24B4 | Severe error while addressing parameter list. |
CPF2401 | Not authorized to library &1. |
CPF2403 | Message queue &1 in &2 not found. |
CPF2408 | Not authorized to message queue &1. |
CPF3CF1 | Error code parameter not valid. |
CPF3C1D | Length specified in parameter &1 not valid. |
CPF3C20 | Error found by program &1. |
CPF3C3A | Value for parameter &2 for API &1 not valid. |
CPF39D0 | Watch for event function cannot start. |
CPF39D1 | Limit exceeded for jobs watching for trace events. |
CPF39EA | Value specified for watched job user name filed is not valid. |
CPF39EB | Watched job name, watched job user name or watched job number field not valid. |
CPF39E3 | Session ID &1 already exists. |
CPF39E5 | No active jobs found, watch session not started. |
CPF39E6 | The user does not have the required authority. |
CPF39E7 | Invalid session identifier. |
CPF39E8 | Not enough authority to watch operations. |
CPF39E9 | *JOBCTL special authority required. |
CPF3958 | Not authorized to use program &1 in library &2. |
CPF9811 | Program &1 in library &2 not found. |
CPF9872 | Program or service program &1 in library &2 ended. Reason code &3. |
Top | Problem Management APIs | APIs by category |