TSO-ISPF JCL COBOL VSAM DB2 CICS IMS-DB Tools Articles Forum Quiz Interview Q&A

JCL - Coding Concepts


Let's understand the coding concepts in JCL,

This chapter takes you through the process of
  1. Creating a data set member for JCL

  2. Coding JCL (using a predefined sample)

  3. Submitting the job

  4. Viewing the job output

Even if you do not have access to a z/OS system to accomplish these tasks, reading through the instructions in this chapter will help you understand how to use JCL to create jobs, submit those jobs and interpret the output.

Before creating any job, you need to know the following:
  1. Installation conventions

    Every job must include special accounting and identifying information, which varies from one z/OS installation to another. To submit your JCL successfully, you need to find out the conventions that are followed at your company.

    You may need to ask a mentor or co-worker to help you identify the job card. So that we will be able to create a job statement for your JCL.

  2. How to allocate and edit a data set

    First, you will be entering JCL statements into a data set so that you can subsequently modify and reuse them as required. Therefore, you must know how to use ISPF panels (or an equivalent technique) to allocate and edit the data set according to the specific requirements of your z/OS system.

    A common programming practice is to use JCL as the last qualifier in the name of any data set that is to contain JCL. for example, userid.SORT.JCL

    Allocate a data set to contain your JCL. Use ISPF (or equivalent function) to allocate a data set named userid.SORT.JCL (where userid is your TSO user ID) with a fixed-block format (RECFM=FB) and a logical record length of 80 (LRECL=80).

  3. The job to be done and the resources needed

    You need to determine what work you plan to have z/OS perform:

    • What inputs (resources) you will need and where they are located

    • What program you plan to use.

    • Where the output, if any, should go. (When the job completes, you will either dispose of the output or hold it for later printing or for viewing).


    For this example, we are going to see sorting a simple file and list the contents alphabetically.

    Edit the JCL data set that you just allocated userid.SORT.JCL and add the below JCL. Use ISPF (or equivalent function) to edit the data set.

    //SORT001  JOB '417','SRINI',NOTIFY=XSR12345,MSGCLASS=S,
    //    MSGLEVEL=(1,1),CLASS=C     ---> JOB statement with parameters
    //*
    //STEP1    EXEC PGM=SORT         ---> EXEC statements to execute SORT utility
    //SYSIN    DD *                  ---> DD statement with DD name SYSIN, specifies how you want the sort to be done
      SORT FIELDS=(1,10,CH,A)
    /*
    //SYSOUT   DD  SYSOUT=*          ---> DD statement with DD name SYSOUT, specifies the data set to which SORT will write its messages.
    //SORTIN   DD  *                 ---> DD statement with DD name SORTIN, specifies input records or file.
    JANUARY
    FEBRUARY
    MARCH
    APRIL
    MAY
    JUNE
    JULY
    AUGUST
    SEPTEMBER
    OCTOBER
    NOVEMBER
    DECEMBER
    /*
    //SORTOUT  DD SYSOUT=*            ---> DD statement with DD name SORTOUT, specifies output record will be return.
    /*

    Note: '--->' symbol is not part of JCL coding. we just added a description for each line for your reference. Please omit the text after the "--->"(including) in your JCL.

  4. Submit the JCL to the system as a job

    When you have finished entering the JCL into the data set, submit the job by entering the SUBMIT command from the ISPF EDIT command line, the TSO/E command line, or following a READY mode message.

    When the job ends, you will receive a message indicating one of three conditions: job successful, JCL error, or program abend.

    If the message indicates the error or abend condition, you have to find the error reason and correct the error. then submit the job again(i.e. review steps 2 and 3 of this exercise to make sure that you followed the instructions exactly, then resubmit the job.).

    Use your installation's viewing facility (for example, SDSF) to view the output and determine whether the job completed successfully.

  5. How to view and understand held output.

    Running your job will produce three types of held output:

    1. System messages from JES and z/OS

    2. Your JCL code with procedures expanded, overrides applied, and symbolics resolved.

    2. Output as requested by the JCL code.


    Held output may be viewed, printed, or purged. You can get below listed deails from the SDSF.

    1. Installation-specific detals and it may differ on each system.

    2. Amount of execution time of the job.

    3. It contains the JCL statements or JCL listing, that resulted from the job.

    4. The system output messages resulting from processing the job.

    5. The condition code 0000 tells you that the program ran successfully. You receive one condition code for each step in the job. If a condition code is non-zero, that means job run failed.

    6. Also, you can see output produced by the program.



If you have any doubts or queries related to this chapter, get them clarified from our Mainframe experts on ibmmainframer Community!

Are you looking for Job Change? Job Portal