In this section, we will guide you through the process of running your first JCL job. By the end of this lesson, you will have a basic understanding of how to submit a JCL job and interpret its output.
Steps to Run Your First JCL Job
- Understanding the Basic Structure
Before running a JCL job, it's essential to understand its basic structure. A JCL job typically consists of the following statements:
- JOB Statement: Defines the job and its attributes.
- EXEC Statement: Specifies the program or procedure to execute.
- DD Statement: Describes the data sets used by the job.
- Writing a Simple JCL Job
Let's start with a simple JCL job that prints "Hello, World!" to the system output. Below is an example of such a job:
//HELLOJOB JOB (ACCT),'Hello World Job',CLASS=A,MSGCLASS=A //STEP1 EXEC PGM=IEBGENER //SYSPRINT DD SYSOUT=* //SYSIN DD DUMMY //SYSUT1 DD * Hello, World! /* //SYSUT2 DD SYSOUT=*
Explanation of the Code:
-
JOB Statement:
//HELLOJOB JOB (ACCT),'Hello World Job',CLASS=A,MSGCLASS=A
HELLOJOB
: Job name.JOB (ACCT)
: Accounting information.'Hello World Job'
: Job description.CLASS=A
: Job class.MSGCLASS=A
: Message class for output.
-
EXEC Statement:
//STEP1 EXEC PGM=IEBGENER
STEP1
: Step name.EXEC PGM=IEBGENER
: Executes the IEBGENER utility program.
-
DD Statements:
//SYSPRINT DD SYSOUT=* //SYSIN DD DUMMY //SYSUT1 DD * Hello, World! /* //SYSUT2 DD SYSOUT=*
SYSPRINT DD SYSOUT=*
: Directs the system output to the default output class.SYSIN DD DUMMY
: Specifies no input for the SYSIN data set.SYSUT1 DD *
: In-stream data, containing "Hello, World!".SYSUT2 DD SYSOUT=*
: Directs the output to the default output class.
- Submitting the JCL Job
To submit the JCL job, follow these steps:
- Access the Mainframe: Log in to your mainframe environment using your credentials.
- Open the JCL Editor: Use an editor like ISPF to create a new JCL member.
- Enter the JCL Code: Copy the above JCL code into the editor.
- Save the JCL Member: Save the member with a suitable name, e.g.,
HELLOJOB
. - Submit the Job: Use the
SUBMIT
command to submit the job for execution.
- Checking the Job Output
After submitting the job, you need to check its output to ensure it ran successfully. Follow these steps:
- Access the Job Output: Use the SDSF (System Display and Search Facility) or equivalent tool to view the job output.
- Locate Your Job: Find your job by its name (
HELLOJOB
) or job number. - Review the Output: Check the output for any error messages and verify that "Hello, World!" is printed.
Example Output
Here is an example of what the output might look like:
JOB HELLOJOB (JOB12345) SUBMITTED ... IEF142I HELLOJOB STEP1 - STEP WAS EXECUTED - COND CODE 0000 ... Hello, World! ...
Practical Exercise
Exercise 1: Run Your First JCL Job
- Write a JCL job that prints "Welcome to JCL!" to the system output.
- Submit the job and check the output.
Solution:
//WELCOME JOB (ACCT),'Welcome Job',CLASS=A,MSGCLASS=A //STEP1 EXEC PGM=IEBGENER //SYSPRINT DD SYSOUT=* //SYSIN DD DUMMY //SYSUT1 DD * Welcome to JCL! /* //SYSUT2 DD SYSOUT=*
Common Mistakes and Tips
- Syntax Errors: Ensure that each JCL statement starts with
//
and follows the correct syntax. - Job Name: The job name should be unique within the system to avoid conflicts.
- Output Classes: Verify that the output classes (
CLASS
andMSGCLASS
) are correctly specified.
Conclusion
In this lesson, you learned how to write and run a simple JCL job. You also learned how to check the job output to verify its execution. This foundational knowledge will help you as you progress through more complex JCL concepts in the upcoming modules.
JCL (Job Control Language) Course
Module 1: Introduction to JCL
Module 2: JCL Statements and Syntax
Module 3: Data Definition (DD) Statements
Module 4: Procedures and Symbolic Parameters
Module 5: Advanced JCL Concepts
- Conditional Processing
- JCLLIB and INCLUDE Statements
- Generation Data Groups (GDGs)
- Restart and Checkpoint
Module 6: Error Handling and Debugging
- Common JCL Errors
- Interpreting JCL Error Messages
- Debugging Techniques
- Using JES2/JES3 for Troubleshooting