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

  1. 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.

  1. 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.

  1. Submitting the JCL Job

To submit the JCL job, follow these steps:

  1. Access the Mainframe: Log in to your mainframe environment using your credentials.
  2. Open the JCL Editor: Use an editor like ISPF to create a new JCL member.
  3. Enter the JCL Code: Copy the above JCL code into the editor.
  4. Save the JCL Member: Save the member with a suitable name, e.g., HELLOJOB.
  5. Submit the Job: Use the SUBMIT command to submit the job for execution.

  1. Checking the Job Output

After submitting the job, you need to check its output to ensure it ran successfully. Follow these steps:

  1. Access the Job Output: Use the SDSF (System Display and Search Facility) or equivalent tool to view the job output.
  2. Locate Your Job: Find your job by its name (HELLOJOB) or job number.
  3. 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

  1. Write a JCL job that prints "Welcome to JCL!" to the system output.
  2. 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 and MSGCLASS) 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.

© Copyright 2024. All rights reserved