Work with Job (WRKJOB)
Where allowed to run: All environments (*ALL) Threadsafe: Conditional |
Parameters Examples Error messages |
The Work with Job (WRKJOB) command allows you to work with or change the following information concerning a user job:
- Job status attributes
- Job definition attributes
- Job run attributes
- Spooled file information
- Job log information
- Call stack information
- Job lock information
- Library list information
- Open file information
- File override information
- Commitment control status
- Communications status
- Activation group information
- Mutex information
- Thread information
- Media library attribute information
- Environment variables
The information for the following options can be shown only when the job is active: job run attributes, call stack information, job lock information, library list information, job log information, open file information, file override information, commitment control status, communications status, activation group information, mutex information, and thread information.
The following options can be found regardless of whether the user's job is on the job queue, on an output queue, or active in the system: job status attributes, job definition attributes, and spooled file information. Note, however, that the job is not considered to be in the system until all of its input has been completely read in; only then is an entry placed on the job queue.
Restrictions:
- 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 worked with, or the issuer of the command must be running under a user profile which has job control (*JOBCTL) special authority.
The job user identity is the name of the user profile by which a job is known to other jobs. More information about the job user identity is in the Work management topic collection in the IBM i Information Center at http://www.ibm.com/systems/i/infocenter/.
- Activation group information for a job cannot be shown if the job is being held when this command is run.
- This command fails in a job that allows multiple threads if OPTION(*FILOVR) or OPTION(*ALL) is specified.
- You must have service (*SERVICE) special authority to display environment variables for a job running under a different user profile.


Top |
Parameters
Keyword | Description | Choices | Notes |
---|---|---|---|
JOB | Job name | Single values: * Other values: Qualified job name |
Optional, Positional 1 |
Qualifier 1: Job name | Name | ||
Qualifier 2: User | Name | ||
Qualifier 3: Number | 000000-999999 | ||
OUTPUT | Output | Optional, Positional 2 | |
OPTION | Option | *SELECT, *STSA, *DFNA, *RUNA, *SPLF, *JOBLOG, *PGMSTK, *JOBLCK, *LIBL, *OPNF, *FILOVR, *CMTCTL, *CMNSTS, *ACTGRP, *MUTEX, *THREAD, *MLBA, *ENVVAR, *ALL | Optional |
SLTTHD | Thread ID to include | Single values: *ALL, *SELECT Other values (up to 20 repetitions): Character value, *INITIAL, *CURRENT |
Optional |
DUPJOBOPT | Duplicate job option | *SELECT, *MSG | Optional |
Top |
Job name (JOB)
Specifies the name of the user job whose information is being worked with.
Single values
- *
- The job whose information is displayed is the job from which this display command is run.
Qualifier 1: Job name
- name
- Specify the name of the job to be displayed. If no job qualifier is given, all of the jobs currently in the system are searched for the simple job name. If duplicates of the specified name are found, a list of messages containing the qualified job names of all duplicates is displayed.
Qualifier 2: User
- name
- Specify the name that identifies the user profile under which the job is run.
Qualifier 3: Number
- 000000-999999
- Specify the job number assigned by the system.
Top |
Output (OUTPUT)
Specifies whether the output from the command is displayed at the requesting work station or printed with the job's spooled output.
- *
- The output is displayed for interactive jobs or printed with the job's spooled output for non-interactive jobs.
- The output is printed with the job's spooled output.
Top |
Option (OPTION)
Specifies which information is being worked with.
- *SELECT
- The menu is shown and all options and function keys are available.
- *STSA
- The identifying characteristics and the status of the job are shown.
- *DFNA
- The definition attributes in the job description associated with the job are shown.
- *RUNA
- The run attributes for the job are shown.
- *SPLF
- The spooled files owned by the job are shown. Only those spooled output files which are on output queues in the library name space of the thread issuing this command will be shown.
- *JOBLOG
- The commands processed by the job and the messages returned from running those commands are shown.
- *PGMSTK
- All information for all programs in the call stack is shown.
- *JOBLCK
- All external object locks held by the job, including held locks and lock that are being waited for, are shown.
- *LIBL
- The library list for the thread is shown if the job specified for the Job name (JOB) parameter is the job from which the command is run. For other jobs, the library list of the initial thread is shown.
- *OPNF
- Files that are open for the job and the status of system and user files are shown.
- *FILOVR
- File overrides at any active call level for the job are shown.
- *CMTCTL
- The commitment control status of the job is shown.
- *CMNSTS
- The communications status of the job is shown.
- *ACTGRP
- The activation groups associated with the job are shown.
- *MUTEX
- The mutex information associated with the initial thread of the job is shown.
- *THREAD
- Information about the job's threads is displayed.
- *MLBA
- Information about the job's media library attributes is displayed.
- *ENVVAR
- The job's environment variables are displayed.
- *ALL
- All options are shown.
Top |
Thread ID to include (SLTTHD)
Specifies a list of thread identifiers whose information is to be included.
Single values
- *ALL
- All threads within the specified job are included.
- *SELECT
- A list of thread identifiers is shown from which the user can select up to twenty to be included. This value is only valid if the command is run in an interactive job.
Other values (up to 20 repetitions)
- *INITIAL
- The initial thread within the specified job is included.
- *CURRENT
- The thread running the command is included. This value is only valid if the specified job is the job running the command.
- thread-identifier
- Specify the identifiers of up to twenty threads whose information is to be included. This is the thread ID as shown by the Work with Job (WRKJOB) command.
Top |
Duplicate job option (DUPJOBOPT)
Specifies the action taken when duplicate jobs are found by this command.
- *SELECT
- The selection display is shown when duplicate jobs are found during an interactive session. Otherwise, a message is issued.
- *MSG
- A message is issued when duplicate jobs are found.
Top |
Examples
Example 1: Printing the Job's Information
WRKJOB JOB(SMITH/PAYROLL) OUTPUT(*PRINT)
This command prints information for the job named PAYROLL submitted by the user named SMITH to the job's output spooling queue.
Example 2: Working with the Current Job's Spooled Output
WRKJOB OPTION(*SPLF)
This command allows you to work with the spooled output for the current job.
Example 3: Working with All of the Current Job's Information
WRKJOB OPTION(*ALL)
This command allows you to work with all of the information for the current job.
Top |
Error messages
*ESCAPE Messages
- CPF0941
- Job &3/&2/&1 no longer in system.
- CPF1069
- End of duplicate names.
- CPF1070
- Job &3/&2/&1 not found.
- CPF1071
- No authority to job &3/&2/&1.
- CPF2443
- Job log not displayed or listed because job has ended.
- CPF3330
- Necessary resource not available.
- CPF3336
- Job &5/&4/&3 no longer in the system.
- CPF9845
- Error occurred while opening file &1.
- CPF9846
- Error while processing file &1 in library &2.
- CPF9847
- Error occurred while closing file &1 in library &2.
- CPF9850
- Override of printer file &1 not allowed.
- CPF9851
- Overflow value for file &1 in &2 too small.
- CPF9871
- Error occurred while processing.
Top |