CL Command Reference - CHGJOB
CL Command List > CHGJOB Reference
Description:
The Change Job (CHGJOB) command changes some of the attributes of a job. With the exception of a change in job queue, the job can be in a job queue or in an output queue, or it can be active in a subsystem. The job queue can only be changed when the job is a batch job and is in a job queue. If the job is in the output queue, only the Output priority (on OUTQ) (OUTPTY), the Job log output (LOGOUTPUT), and the Spooled file action (SPLFACN) can be changed. With the exception of the class attributes, the new attributes remain in effect for the duration of the job unless they are changed by another CHGJOB command. The class attributes remain in effect until the routing step that is currently active ends. If no routing step is active when the changes are made, they apply to the next routing step that is started. If an attribute that no longer affects the job is changed, a message is sent to the user of the command. For example, if the job has already completed running, it is too late to change the Output queue (OUTQ) and Job priority (on JOBQ) (JOBPTY) parameters. If any output files are still on the output queue, however, changing the OUTPTY parameter changes their output priority.
Restrictions:
1. The command must be issued from within the job being changed, or 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 changed, 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. It is described in more detail in the Work Management Guide.
2. To use this command, the following authorities are required:
. To change the job queue (JOBQ), you must have use (*USE) authority to the job queue that the job is being changed to and execute (*EXECUTE) authority to the library containing that job queue.
. To change the output queue (OUTQ), you must have read (*READ) authority to the output queue that is currently allocated to the job and execute (*EXECUTE) authority to the library containing this output queue. This authority can come from program adoption. When a job changes itself, no authority is required to the OUTQ currently allocated to the job. You also must have read (*READ) authority to the output queue that the job is being changed to use, and execute (*EXECUTE) authority to the library containing that output queue. This authority cannot come from program adoption.
. To change the RUNPTY, TIMESLICE, PURGE, DFTWAIT, or TSEPOOL values, you must have job control (*JOBCTL) special authority. v To change the sort sequence table (SRTSEQ), you must have use (*USE) authority to the new sort sequence table and execute (*EXECUTE) authority to the library that contains that sort sequence table.
3. This command is conditionally threadsafe. Refer to Considerations for Attribute Thread Safety for additional information.
Examples:
Example 1: Changing Message Logging Values
CHGJOB JOB(123581/DEPT2/WS1) LOG(2 40 *SECLVL)
This command changes the job WS1, which is associated with the user profile DEPT2, and has the job number 123581. It receives only commands and associated diagnostic messages (help text) if the messages have a severity level greater than or equal to 40. Help text, in addition to the message text, is logged in the job log.
Example 2: Changing Scheduling Priority and Job Switches
CHGJOB JOB(PAYROLL) JOBPTY(4) OUTPTY(3) SWS(10XXXX00)
This command changes the scheduling priority for the job PAYROLL to 4 and the priority of the jobĄ¯s output to 3. Also, four of the eight job switches are changed: switches 1 and 2 are set to 1 and 0, switches 3 through 6 remain the same, and switches 7 and 8 are both set to 0. Because only the simple name of the job is specified, there can be only one job named PAYROLL in the system.
Example 3: Moving a Job to Another Queue
CHGJOB JOB(MYJOB) JOBQ(MYLIB/MYJOBQ) INQMSGRPY(*SYSRPYL)
This command moves the job from the job queue it is currently in to the job queue MYJOBQ in library MYLIB. For this change to be made, the job must not have begun running and must be a batch job. Also, the job is changed so that any inquiry message that is issued on behalf of this job that has an entry in the system automatic reply list is answered according to the reply in that system reply list entry. For any inquiry message not represented in the system reply list, a reply is required.
Example 4: Changing Run Priority and Default Wait Time
CHGJOB JOB(MYJOB) RUNPTY(10) DFTWAIT(150)
This command changes the run priority of the job MYJOB to 10 and the default wait time to 150 seconds, if the issuer of the command has job control authority. If the job is active, these changes take effect immediately. If the job is on a job queue, when the next routing step for the job is started, the run priority and default wait times become these values and not what was specified in the class associated with the routing entry used to start the step.