Reusable JCL collection
Previous topic | Next topic | Contents | Glossary | Contact z/OS | PDF


JCL exercise: Creating and submitting a job

Reusable JCL collection

This exercise takes you through the process of creating a data set member for JCL, coding JCL (using a predefined sample), submitting the job, and 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 exercise will help you understand how to use JCL to create jobs, submit those jobs and interpret the output.

Before you begin
Before creating any job, you need to know the following:
  • 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.

    Use the worksheet in Coding JCL: Collecting company-specific information for documenting this information. You may need to ask a mentor or co-worker to help you identify the conventions indicated in the worksheet.

  • How to allocate and edit a data set. During the exercise, 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.
    Note:
    1. 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
    2. A data set that contains JCL must have a fixed-block format (RECFM=FB) with a logical record length of 80 (LRECL=80).
  • 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.)

    The job for this exercise is to sort a simple file and list the contents alphabetically. Decisions about inputs, outputs, and processing have already been made for you, so all you will have to do is to copy the example code provided.

  • How to view and understand held output. Running your job will produce three types of held output:
    • System messages from JES and z/OS
    • Your JCL code with procedures expanded, overrides applied, and symbolics resolved.
    • Output as requested by the JCL code

    Held output may be viewed, printed, or purged. Sample output shows you how the output from the exercise should look and explains what each part of the output means.

Procedure
  1. 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).
  2. Edit the JCL data set and add the necessary JCL. Use ISPF (or equivalent function) to edit the data set that you just allocated.
    1. Enter the following JCL statements into the data set. Note that all JCL statements start with the special identifier //.
      //SORT JOB 'accounting_data',  1  
      //  'user_name',  2  
      //  NOTIFY=&SYSUID,  3  
      //  MSGCLASS=message_class,  4  
      //  MSGLEVEL=(1,1),  5  
      //  CLASS=n,  6  
      //STEP1    EXEC  PGM=IEFBR14  7  
      //SORTIN   DD  *  8  
      NEPTUNE  9  
      PLUTO 
      EARTH 
      VENUS 
      MERCURY 
      MARS 
      URANUS 
      SATURN 
      JUPITER 
      /*  10  
      //SORTOUT  DD SYSOUT=*  11  
      /*  12 
      In the JCL code above:
       1 
      Replace accounting_data with the appropriate security classification and identification information, according to the information you filled in on Coding JCL: Collecting company-specific information.
       2 
      Replace user_name with your name.
       3 
      The NOTIFY parameter tells the system where to send “job complete” information. &SYSUID tells the system to automatically insert your user ID here, so the information will be sent to you.
       4 
      The MSGCLASS parameter tells the system what to do with messages the system sends you as it processes your job; for example, use a held output class to allow reviewing the messages later. Replace message_class with the appropriate message class value.
       5 
      MSGLEVEL=(1,1) tells the system to reproduce this JCL code in the output, and to include allocation messages.
       6 
      CLASS=n indicates the system resource requirements for the job.
       7 
      The EXEC statement invokes the program IEFBR14 and identifies the first (and only) job step in this job. You are arbitrarily naming it STEP1. All of the control statements that follow the EXEC statement are part of this job step.

      IEFBR14 is the name of a program within your z/OS system. It does not actually process any data, but it enables you to run this job as a test to verify the JCL statements, and to create the input data. Later in the exercise you will replace IEFBR14 with the name of another program that sorts data.

       8 
      SORTIN is the name you have given the DD statement that describes the input data.
       9 
      NEPTUNE through JUPITER are the items to be sorted. This method of providing data to the program is referred to as in-stream data, an alternative to providing the input in a separate allocated data set.
       10 
      The symbols /* indicates the end of the input data stream.
       11 
      SORTOUT is the name you have given the DD statement that describes where the output from running the job will be placed. In this example, SYSOUT=* specifies that the output data will be directed to the SYSOUT device defined in the MSGCLASS statement.
       12 
      The symbols /* (optional) denote the end of the job.
  3. 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. Each of these methods is shown below.
    • ISPF EDIT command line:
       EDIT ---- userid.SORT.JCL -------------------------- LINE 00000000 COL 001 080  
       COMMAND ===> SUBMIT                                           SCROLL ===> CSR 
      ********************************* TOP OF DATA  ******************************** 
      //userid   JOB 'accounting data', 
                            .
                            . 
                            .
      
    • TSO/E command line:
      -------------------------  TSO COMMAND PROCESSOR  ---------------------------- 
      ENTER TSO COMMAND OR CLIST BELOW:   
      
      
      ===> SUBMIT 'userid.SORT.JCL'     
      
      
      
      ENTER SESSION MANAGER MODE ===> NO     (YES or NO)
    • After READY mode message:
          .
          . 
          .   
       READY   
      SUBMIT 'userid.SORT.JCL'
      
        
      Note: When entering the command from the TSO command line or after a READY message, you must surround the data set name with single quotation marks if you include your user ID. However, you can also enter the command without specifying your user ID and without using single quotation marks, as shown below:
      SUBMIT SORT.JCL

      When you do not specify the user ID and do not include single quotes, the system automatically inserts your user ID before the data set name. (The insertion of the user ID is for the duration of the current job; it is not a permanent change to the data set name.)

    After entering the command, you should receive the following message indicating that your job was submitted successfully:
    • When submitted from the ISPF EDIT command line:
       EDIT ---- userid.SORT.JCL -------------------------- LINE 00000000 COL 001 080  
       COMMAND ===> SUBMIT                                           SCROLL ===> CSR 
      ********************************* TOP OF DATA  ******************************** 
      //userid   JOB 'accounting data',
                             .
                             .
                             . 
      JOB jobname(jobnumber) SUBMITTED
      ***
      
    • When submitted from the TSO command line:
      -------------------------  TSO COMMAND PROCESSOR  ----------- 
      ENTER TSO COMMAND OR CLIST BELOW:  
      
      ===> SUBMIT 'userid.SORT.JCL'      
      
      
      
      
      
      
      ENTER SESSION MANAGER MODE ===> NO     (YES or NO) 
      JOB jobname(jobnumber) SUBMITTED
      ***
    • When submitted after READY mode message:
          .
          .
          .
         READY   
        SUBMIT 'userid.SORT.JCL'
          .
          .
          . 
      JOB jobname(jobnumber) SUBMITTED
      ***
          .
          .
         READY  

    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, review steps 2 and 3 of this exercise to make sure that you followed the instructions exactly, then resubmit the job.

    If the job fails again, consult the appropriate messages as indicated below:
    • If the message begins with HASP, the job was failed by JES2.
    • If the message begins with IAT, the job was failed by JES3.
  4. View and understand the output from the job. Use your installation's viewing facility (for example, SDSF) to view the output and determine whether the job completed successfully.

    If the job is on hold in the held queue, consider printing it for a record of the job activity.

    Figure 1. Output from Job Invoking IEFBR14 Program
    1                     J E S 2  J O B  L O G  --  S Y S T E M  A Q T S  --  N O D E  P L P S C
    0
     15.21.28 JOB17653  IRR010I  USERID userid   IS ASSIGNED TO THIS JOB.
     15.21.28 JOB17653  ICH70001I userid   LAST ACCESS AT 15:21:28 ON WEDNESDAY, OCTOBER 13, 2006
     15.21.28 JOB17653  $HASP373 SORT  STARTED - INIT    9 - CLASS 5 - SYS AQTS 
     15.21.28 JOB17653  IEF403I SORT - STARTED - TIME=15.21.28                                                 1  
     15.21.28 JOB17653  - ==============================================================================================================
     15.21.28 JOB17653  -                                    REGION        --- STEP TIMINGS ---                   ----PAGING COUNTS---- 
     15.21.28 JOB17653  - STEPNAME PROCSTEP PGMNAME     CC     USED      CPU TIME  ELAPSED TIME    EXCP     SERV  PAGE  SWAP   VIO SWAPS
     15.21.28 JOB17653  - STEP1             IEFBR14     00       4K   00:00:00.01   00:00:00.03       1      211     0     0     0     0
     15.21.28 JOB17653  IEF404I SORT - ENDED - TIME=15.21.28
     15.21.28 JOB17653  - ==============================================================================================================
     15.21.28 JOB17653  - NAME-user_name        TOTALS: CPU TIME=  00:00:00.01  ELAPSED TIME=  00:00:00.05 SERVICE UNITS=    21
     15.21.28 JOB17653  - ==============================================================================================================
     15.21.28 JOB17653  $HASP395 SORT  ENDED
    0------ JES2 JOB STATISTICS ------
    -  13 OCT 1996 JOB EXECUTION DATE 
    -           20 CARDS READ 
    -           45 SYSOUT PRINT RECORDS                                                                       2  
    -            0 SYSOUT PUNCH RECORDS
    -            3 SYSOUT SPOOL KBYTES
    -         0.00 MINUTES EXECUTION TIME
             1 //SORT JOB '662282,D58,9211064,S=C',                                 JOB17653 
               //  'user_name',  
               //  NOTIFY=userid, 
               //  MSGCLASS=H,                                                         00280009
               //  MSGLEVEL=(1,1),                                                     00430010               3 
               //  CLASS=5                                                             00430010
             2 //STEP1    EXEC  PGM=IEFBR14 
             3 //SORTIN  DD *         
             4 //SORTOUT  DD SYSOUT=*  
             5 //SYSIN     DD *               GENERATED STATEMENT
     ICH70001I userid   LAST ACCESS AT 15:21:28 ON WEDNESDAY, OCTOBER 13, 2006  IEF236I ALLOC. FOR SORT STEP1  
     IEF237I JES2 ALLOCATED TO DATAIN  
     IEF237I JES2 ALLOCATED TO SYSIN 
     IEF142I SORT STEP1 - STEP WAS EXECUTED - COND CODE 0000           5 
     IEF285I   userid.SORT.JOB17653.D0000101.?           SYSIN                             4   
     IEF285I   userid.SORT.JOB17653.D0000103.?           SYSOUT 
     IEF285I   userid.SORT.JOB17653.D0000102.?           SYSIN
     IEF373I STEP /STEP1   / START 1996286.1521  
     IEF374I STEP /STEP1   / STOP  1996286.1521 CPU    0MIN 00.01SEC SRB    0MIN 00.00SEC VIRT     4K SYS   180K EXT       4K SYS    9424K
     IEF375I  JOB /SORT / START 1996286.1521  
     IEF376I  JOB /SORT / STOP  1996286.1521 CPU    0MIN 00.01SEC SRB    0MIN 00.00SEC 
    
    Figure 1 contains an example of the held output for this exercise. Each part of this output is explained below:
    • The first block of information ( 1 ), ending with the line $HASP395 SORT ENDED, is installation-specific and may differ on your system.
    • The JES2 job statistics section ( 2 ), ending with the amount of execution time (0.00 MINUTES EXECUTION TIME), contains JES messages about the job.
    • The next section ( 3 ) contains the JCL statements, or JCL listing, that resulted from the job.
    • The final section ( 4 ), beginning with message ICH70001I, contains the system output messages resulting from processing the job.
    • Within the final section, the condition code 0000 ( 5 ) 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, see the documentation for the specific program you invoked.
  5. Make changes to your JCL. When your job has run successfully, edit the data set containing the JCL and change or add control statements as indicated below:
    //SORT JOB 'accounting_data', 
    //  'user_name', 
    //  NOTIFY=&SYSUID, 
    //  MSGCLASS=H, 
    //  MSGLEVEL=(1,1), 
    //  CLASS=5 
    //STEP1    EXEC  PGM=SORT  1  
    //SYSIN   DD *    SORT     FIELDS=(1,75,CH,A)  2  
    /* 
    //SYSOUT   DD  SYSOUT=*    3  
    //SORTIN   DD  * 
    NEPTUNE 
    PLUTO 
    EARTH 
    VENUS 
    MERCURY 
    MARS 
    URANUS 
    SATURN 
    JUPITER 
    /* 
    //SORTOUT  DD SYSOUT=* 
    /*
     1 
    Replace the program name with the name of your sort program. In this job, SORT will sort the input data identified by the SORTIN DD statement.
     2 
    Add the SYSIN control statement. SYSIN specifies how you want the sort to be done. In this case, you are indicating that you want to sort the fields from column 1 to column 75 as characters in ascending sequence.
     3 
    Add the SYSOUT control statement. SYSOUT specifies the data set to which SORT will write its messages. A SYSOUT data set is a system-handled output data set. This data set is placed temporarily on direct access storage. Later, the system prints it or sends it to a specified location.

    When you have finished entering the JCL into the data set, submit the job.

  6. View and understand your final output. Figure 2 shows an example of the held output for the completed exercise. Each part of this output is explained below:
    Figure 2. Output from Job Invoking SORT Program
    1                      J E S 2  J O B  L O G  --  S Y S T E M  A Q T S  --  N O D E  P L P S C 
    0
     13.40.27 JOB06572  IRR010I  USERID 'userid' IS ASSIGNED TO THIS JOB.     
     13.40.27 JOB06572  ICH70001I 'userid' LAST ACCESS AT 13:39:20 ON MONDAY, NOVEMBER 15, 2006 
     13.40.27 JOB06572  $HASP373 SORT     STARTED - INIT    9 - CLASS 5 - SYS AQTS 
     13.40.27 JOB06572  IEF403I SORT - STARTED - TIME=13.40.27                                                1 
     13.40.28 JOB06572  - ============================================================================================================== 
     13.40.28 JOB06572  -                                    REGION        --- STEP TIMINGS ---                   ----PAGING COUNTS---- 
     13.40.28 JOB06572  - STEPNAME PROCSTEP PGMNAME     CC     USED      CPU TIME  ELAPSED TIME    EXCP     SERV  PAGE  SWAP   VIO SWAPS 
     13.40.28 JOB06572  - STEP1             SORT        00     576K   00:00:00.03   00:00:00.15      20     1614     0     0     0     0  
     13.40.28 JOB06572  IEF404I SORT - ENDED - TIME=13.40.28  
     13.40.28 JOB06572  - ============================================================================================================== 
     13.40.28 JOB06572  - NAME-'user name'          TOTALS: CPU TIME=  00:00:00.03  ELAPSED TIME=  00:00:00.16 SERVICE UNITS=   1614  
     13.40.28 JOB06572  - ==============================================================================================================  
     13.40.28 JOB06572  $HASP395 SORT     ENDED 
    0------ JES2 JOB STATISTICS ------ 
    -  15 NOV 1996 JOB EXECUTION DATE  
    -           25 CARDS READ 
    -           81 SYSOUT PRINT RECORDS                                                                       2 
    -            0 SYSOUT PUNCH RECORDS 
    -            4 SYSOUT SPOOL KBYTES 
    -         0.00 MINUTES EXECUTION TIME 
             1 //SORT JOB 'accounting data',                                           JOB06572 
               //  'user_name',  
               //  NOTIFY=userid, 
               //  MSGCLASS=H,      
               //  MSGLEVEL=(1,1),   
               //  CLASS=5                                                                                    3  
             2 //STEP1    EXEC  PGM=SORT 
             3 //SYSIN   DD *  
             4 //SYSOUT   DD  SYSOUT=*  
             5 //SORTIN   DD  *   
             6 //SORTOUT  DD SYSOUT=*  
               /*              
     ICH70001I 'userid' LAST ACCESS AT 13:39:20 ON MONDAY, NOVEMBER 15, 2006 
     IEF236I ALLOC. FOR SORT STEP1  
     IEF237I JES2 ALLOCATED TO SYSIN  
     IEF237I JES2 ALLOCATED TO SYSOUT  
     IEF237I JES2 ALLOCATED TO SORTIN  
     IEF237I JES2 ALLOCATED TO SORTOUT
     IEF142I SORT STEP1 - STEP WAS EXECUTED - COND CODE 0000           5  
     IEF285I   userid.SORT.JOB06572.D0000101.?              SYSIN     
     IEF285I   userid.SORT.JOB06572.D0000103.?              SYSOUT 
     IEF285I   userid.SORT.JOB06572.D0000102.?              SYSIN 
     IEF285I   userid.SORT.JOB06572.D0000104.?              SYSOUT 
     IEF373I STEP /STEP1   / START 1996319.1340   
     IEF374I STEP /STEP1   / STOP  1996319.1340 CPU    0MIN 00.03SEC SRB    0MIN 00.00SEC VIRT   576K SYS   188K EXT    4096K SYS    9444K
     IEF375I  JOB /SORT    / START 1996319.1340  
     IEF376I  JOB /SORT    / STOP  1996319.1340 CPU    0MIN 00.03SEC SRB    0MIN 00.00SEC 
    1ICE143I 0 BLOCKSET     SORT  TECHNIQUE SELECTED                                                          4  
     ICE000I 1 --- CONTROL STATEMENTS/MESSAGES ---- 5740-SM1 REL 12.0 ---- 13.40.28 NOV 15, 2006 -- 
    0             SORT     FIELDS=(1,75,CH,A)  
     ICE088I 1 SORT    .STEP1   .        , INPUT LRECL = 80, BLKSIZE = 80, TYPE = F   
     ICE093I 0 MAIN STORAGE = (MAX,4194304,4194304) 
     ICE156I 0 MAIN STORAGE ABOVE 16MB = (3624960,3624960) 
     ICE128I 0 OPTIONS: SIZE=4194304,MAXLIM=1048576,MINLIM=450560,EQUALS=N,LIST=Y,ERET=RC16 ,MSGDDN=SYSOUT  
     ICE129I 0 OPTIONS: VIO=N,RESDNT=ALL ,SMF=NO   ,WRKSEC=Y,OUTSEC=Y,VERIFY=N,CHALT=N,DYNALOC=N            ,ABCODE=MSG 
     ICE130I 0 OPTIONS: RESALL=4096,RESINV=0,SVC=109 ,CHECK=Y,WRKREL=Y,OUTREL=Y,CKPT=N,STIMER=Y,COBEXIT=COB1  
     ICE131I 0 OPTIONS: TMAXLIM=4194304,ARESALL=0,ARESINV=0,OVERRGN=65536,EXCPVR=NONE ,CINV=Y,CFW=Y 
     ICE132I 0 OPTIONS: VLSHRT=N,ZDPRINT=N,IEXIT=N,TEXIT=N,LISTX=N,EFS=NONE    ,EXITCK=S,PARMDDN=DFSPARM ,FSZEST=N 
     ICE133I 0 OPTIONS: HIPRMAX=OPTIMAL ,DSPSIZE=MAX   
     ICE084I 0 BSAM ACCESS METHOD USED FOR SORTOUT 
     ICE084I 0 BSAM ACCESS METHOD USED FOR SORTIN 
     ICE090I 0 OUTPUT LRECL = 80, BLKSIZE = 80, TYPE = F 
     ICE080I 0 IN MAIN STORAGE SORT  
     ICE055I 0 INSERT 0, DELETE 0  
     ICE054I 0 RECORDS - IN: 9, OUT: 9  
     ICE134I 0 NUMBER OF BYTES SORTED: 720 
     ICE180I 0 HIPERSPACE STORAGE USED = 0K BYTES 
     ICE188I 0 DATA SPACE STORAGE USED = 0K BYTES 
     ICE052I 0 END OF DFSORT   
     EARTH 
     JUPITER    
     MARS 
     MERCURY 
     NEPTUNE                                                                                                  6 
     PLUTO 
     SATURN  
     URANUS 
     VENUS 
    
    • The first block of information ( 1 ), ending with the line $HASP395 SORT ENDED, is installation-specific and may differ on your system.
    • The JES2 job statistics section ( 2 ), ending with the amount of execution time, contains JES messages about the job.
    • The next section ( 3 ) contains the JCL statements, or JCL listing, that resulted from the job.
    • The next section ( 4 ), beginning with message ICH70001I and ending with message ICE052I, contains the system output messages resulting from processing the job.
    • Within the system output messages, the condition code 0000 ( 5 ) 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, see the documentation for the specific program you invoked (in this case, SORT).
    • The final section ( 6 ), from EARTH to VENUS, contains the output produced by the SORT program.




Copyright IBM Corporation 1990, 2010