End Watch (ENDWCH)
Where allowed to run: All environments (*ALL) Threadsafe: No |
Parameters Examples Error messages |
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:
- To use this command, you must have service (*SERVICE) special authority, or be authorized to the Service watch function of 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.
- If ending a watch session that is watching for a message within a job log, the issuer of the command 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 command 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 ending a watch session that was started specifying *ALL for the watch job name, or a generic user name, you must have *ALLOBJ special authority, or be authorized to the Watch any job function of 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.
Top |
Parameters
Keyword | Description | Choices | Notes |
---|---|---|---|
SSNID | Session ID | Generic name, name, *PRV, *ALL | Required, Positional 1 |
Top |
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.
Top |
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.
Top |
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.
Top |