End Watch (QSCEWCH) API


  Required Parameter Group:

1 Session ID Input Char(10)
2 Error Code I/O Char(*)

  Default Public Authority: *EXCLUDE

  Threadsafe: Yes

The End Watch (QSCEWCH) API ends a watch session that was started by a STRWCH (Start Watch) command or by the Start Watch (QSCSWCH) API. Watch sessions started by trace commands (STRTRC, TRCINT, TRCCNN, STRCMNTRC, TRCTCPAPP) will be ended but the associated trace will remain active.

Note: A watch session can be ended from the same job that issued the start function or from a different job.


Authorities and Locks

Authority to use the API
To use this API, you must have service (*SERVICE) special authority or must be authorized to the Service watch function of the IBM i through System i™ Navigator's Application Administration support. The Change Function Usage (CHGFCNUSG) command, with a function ID of QIBM_SERVICE_WATCH, can also be used to change the list of users that are allowed to start and end watch operations.

Authority to watch session
If ending a watch session that is watching for a message within a job log, the issuer of the API must be running under a user profile which is the same as the job user identity of the job being watched, or the issuer of the API must be running under a user profile which has job control (*JOBCTL) special authority. Job control (*JOBCTL) special authority is also required when ending a session where jobs with a generic user name are being watched.

If you end a watch session that was started with *ALL for the watch job name or with a generic user name, you must have *ALLOBJ special authority or must be authorized to the Watch Any Job function of the IBM i through System i 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.


Required Parameter Group

Session ID
INPUT; CHAR(10)

The session identifier for the watch to be ended. This name must match the session identifier of a watch that had been previously started and is still active. You can use these special values for this parameter:

*PRV The watch session most recently started by the same user who is running this API will be ended. For example, if the job running the API is running under user profile BOB, the last watch session started under user profile BOB is ended.
Start of change*ALL All active watch sessions are to be ended.
generic-name The generic watch session(s) to be ended. 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 name specifies all sessions with identifiers that begin with the generic prefix that are to be ended.End of change
Error code
I/O; CHAR(*)

The structure in which to return error information. For the format of the structure, see Error code parameter.


Error Messages

The following messages may be sent from this function:

Message ID Error Message Text
CPF24B4 Severe error while addressing parameter list.
Start of changeCPF3C20 Error found by program &1.End of change
CPF3CF1 Error code parameter not valid.
CPF39E1 Watch session ID &1 not found.
CPF39E2 There is no active watch session for current user profile.
CPF39E6 The user does not have the required authority.
CPF39E8 Not enough authority to watch operations.
CPF39E9 *JOBCTL special authority required.
Start of changeCPF39EE &1 watch sessions ended. &2 not ended.End of change
Start of changeCPF39EF No watch sessions matching the &1 criteria.End of change
CPF9872 Program or service program &1 in library &2 ended. Reason code &3.
Start of changeCPF9899 Error occurred during processing of command.End of change



API introduced: V5R4

[ Back to top | Problem Management APIs | APIs by category ]