In this section, we will explore the various commands available in Control Language (CL) for managing jobs. Jobs are fundamental units of work in a system, and understanding how to manage them is crucial for efficient system administration.

Key Concepts

  1. Job: A job is a unit of work that the system performs. It can be a batch job, an interactive job, or a system job.
  2. Job Queue: A job queue is a queue where jobs wait to be processed.
  3. Job Description: A job description contains attributes that define how a job should be run.
  4. Subsystem: A subsystem is a single, predefined operating environment through which the system coordinates the work flow and resource usage.

Common Job Management Commands

  1. Submitting a Job (SBMJOB)

The SBMJOB command is used to submit a job to a job queue.

Syntax:

SBMJOB CMD(command) JOB(job-name) JOBQ(job-queue-name)

Example:

SBMJOB CMD(CALL PGM(MYPGM)) JOB(MYJOB) JOBQ(QBATCH)

This command submits a job named MYJOB to the job queue QBATCH to call the program MYPGM.

  1. Displaying Job Status (WRKJOB)

The WRKJOB command is used to display the status of a job.

Syntax:

WRKJOB JOB(job-name)

Example:

WRKJOB JOB(MYJOB)

This command displays the status and details of the job named MYJOB.

  1. Ending a Job (ENDJOB)

The ENDJOB command is used to end a job.

Syntax:

ENDJOB JOB(job-name) OPTION(*IMMED)

Example:

ENDJOB JOB(MYJOB) OPTION(*IMMED)

This command ends the job named MYJOB immediately.

  1. Holding a Job (HLDJOB)

The HLDJOB command is used to hold a job, preventing it from running.

Syntax:

HLDJOB JOB(job-name)

Example:

HLDJOB JOB(MYJOB)

This command holds the job named MYJOB.

  1. Releasing a Job (RLSJOB)

The RLSJOB command is used to release a job that was previously held.

Syntax:

RLSJOB JOB(job-name)

Example:

RLSJOB JOB(MYJOB)

This command releases the job named MYJOB.

  1. Changing Job Attributes (CHGJOB)

The CHGJOB command is used to change the attributes of a job.

Syntax:

CHGJOB JOB(job-name) RUNPTY(priority)

Example:

CHGJOB JOB(MYJOB) RUNPTY(20)

This command changes the run priority of the job named MYJOB to 20.

Practical Exercise

Exercise 1: Submitting and Managing a Job

  1. Submit a Job: Submit a job named TESTJOB to call a program TESTPGM in the job queue QGPL.

    SBMJOB CMD(CALL PGM(TESTPGM)) JOB(TESTJOB) JOBQ(QGPL)
    
  2. Display Job Status: Display the status of the job TESTJOB.

    WRKJOB JOB(TESTJOB)
    
  3. Hold the Job: Hold the job TESTJOB.

    HLDJOB JOB(TESTJOB)
    
  4. Release the Job: Release the job TESTJOB.

    RLSJOB JOB(TESTJOB)
    
  5. End the Job: End the job TESTJOB immediately.

    ENDJOB JOB(TESTJOB) OPTION(*IMMED)
    

Solution

  1. Submit a Job:

    SBMJOB CMD(CALL PGM(TESTPGM)) JOB(TESTJOB) JOBQ(QGPL)
    
  2. Display Job Status:

    WRKJOB JOB(TESTJOB)
    
  3. Hold the Job:

    HLDJOB JOB(TESTJOB)
    
  4. Release the Job:

    RLSJOB JOB(TESTJOB)
    
  5. End the Job:

    ENDJOB JOB(TESTJOB) OPTION(*IMMED)
    

Common Mistakes and Tips

  • Incorrect Job Name: Ensure the job name specified in the commands matches the actual job name.
  • Job Queue Availability: Verify that the job queue specified is available and not full.
  • Permissions: Ensure you have the necessary permissions to manage jobs.

Conclusion

In this section, we covered the essential commands for managing jobs in CL. You learned how to submit, display, hold, release, and end jobs. These commands are fundamental for effective job management and system administration. In the next section, we will explore system management commands to further enhance your control over the system.

© Copyright 2024. All rights reserved