End Watch (ENDWCH)

The End Watch (ENDWCH) command ends a watch session that was started by a STRWCH (Start Watch) command or by 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.

Restrictions:

Parameters

Keyword Description Choices Notes
SSNID Session ID Generic name, name, *PRV, *ALL Required, Positional 1

Session ID (SSNID)

Specifies a session identifier for the watch to be ended. This name must match the session identifier of a watch session that had been previously started and is still active.

This is a required parameter.

*PRV
The watch session most recently started by the same user who is running this ENDWCH command will be ended. For example, if the job running the ENDWCH command is running under user profile BOB, the last watch session started under user profile BOB is ended.
*ALL
All active watch sessions are to be ended.
generic-name
Specify 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.
name
Specify the session identifier of the watch to be ended.

Examples

Example 1: End Most Recently Started Watch

ENDWCH   SSNID(*PRV)

This command ends the watch session started most recently by the same user who is running the ENDWCH command.

Example 2: End a Specific Watch Session

ENDWCH   SSNID(MYSESSION)

This command ends the watch session MYSESSION.

Example 3: End a Generic Watch Session

ENDWCH   SSNID(SSN0*)

This command ends all active watch sessions whose identifier starts with the prefix SSN0.

Example 4: End All Watch Sessions

ENDWCH   SSNID(*ALL)

This command ends all the watch sessions active on the system.

Error messages

*ESCAPE Messages

CPF39E1
Watch session &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.
CPF39EE
&1 watch sessions ended. &2 not ended.
CPF39EF
No watch sessions matching the &1 criteria.
CPF9899
Error occurred during processing of command.