About Author

Friday, 8 July 2011

JOB CONTROL LANGUAGE (JCL)

Brief Introduction


what is JCL? 

Job control language. It is a means of communication between a program that 
can be written in COBOL , ASSEMBER or PL/I and the MVS operating system. Without
a JCL, you cant able to run a job on MVS operating system.

Let us start with an example jcl, how it looks like, The following jcl is 
used to run an cobol program. I will explain in this blog each and every 
line of this jcl.
 
JCL , used to run a cobol program

//JOB1    JOB  (024),'NEERAJ BHATT',CLASS='A',PRTY=6
//STEP01  EXEC PGM=COBPROG.
//INFILE  DD   DSN=SED.GLOB.DES.INFILE,DISP=SHR
//OUTIFLE DD   DSN=SED.GLOB.DES.OUTFILE,
//             DISP=(NEW,CATLG,DELETE),
//             UNIT=DISK,
//             SPACE=(CYL,(1,5),RLSE),
//             DCB=(RECFM=FB,LERECL=70,BLKSIZE=700)
 
 
 
All JCL statements can consists of up to five types of fields

  // The two forward slashes are required at the beginning of each JCL statement in Columns 1 and 2.

  Name field - This is an optional field. If coded, should start at
               Column 3. It maximum length is 8.

  Operation field - Which indicates the operation that is to be performed

  Operand - This field must appear after Operation field. Must start at 16 
            column 

  Comments - Comments begin one space after the last operand. Our simple 
             example has no comments.
 



The three important input operations are

1. JOB   

2. EXEC  

3. DD


Now first look at JOB statement
 
   
Syntax of JOB Statement
 
 
 
  
Now i will explain you the keyword parameters one by one :-
                 
(CLASS  PRTY  MSGCLASS  MSGLEVEL  TYPRUN  NOTIFY)



1. CLASS - Some jobs can be short running, some jobs may take more time other 
           may use heavy resources. CLASS keyword parameter is used to tell to 
           OS about the nature of job we are submitting.

   Syntax        ->  CLASS=jobclass  

   Valid values  ->  Any alphabetical character between A - Z  or
                     numbers between 0 - 9   

   Example JCL   ->  //MYJOB JOB (024),'NEERAJ',CLASS=K



2. PRTY  - It is related to CLASS parameter. It assigns priority to jobs which 
           belong to the same class. Higher number takes precedence over the 
           job with lower number. A job with priority of 12 will run before a 
           job with priority 5.

   Syntax        ->  PRTY=priority

   Valid values  ->  Any value between 0 to 15

   Example JCL   ->  //MYJOB JOB (024),'NEERAJ',CLASS=8,PRTY=6 



3. MSGCLASS - The MSGCLASS parameter determines the output device to which 
              system messages and JCL messages are written

   Syntax        ->  MSGCLASS=output-class-name

   Valid values  ->  Any alpha betical character between A - Z  or 
                     number between 0 - 9   

   Example JCL   ->  //MYJOB JOB (024),'NEERAJ',CLASS=7,PRTY=5,MSGCLASS=A


                     
4. MSGLEVEL - is used to tell JCL, which messages to be printed in the device 
              specified in MSGCLASS parameter

   Syntax        ->  MSGLEVEL=(statements,messages)

   Valid values  ->  Statements may be the number 0,1,2 and messages can be 0 or 1

                     STATEMENT
                     0  -  Related to job statements only printed
                     1  -  Jcl will be printed 
                           (which includes all cataloged/symbolic parameters)
                     2  -  only the input jcl statements being printed

                     MESSAGES           
                     0  -  Allocation/termination messages will be printed
                           If job terminates abnormally
                     1  -  Allocation/termination messages will be printed
                           regardless of whether the job terminates normally or abnormally.
         

    Example JCL  -> //MYJOB JOB (024),'NEERAJ',CLASS=8,MSGCLASS=S,MSGLEVEL=(1,1)



5. TYPRUN - The TYPRUN parameter is used to specify whether job is to be held 
            until further notice or for syntax checking
              
    Syntax        ->   TYPRUN=HOLD  -  Job held until further notice 
                                       or
                       TYPRUN=SCAN  -  Check Jcl for syntax checking

                                                                

    Example JCL  ->  //MYJOB JOB (024),'NEERAJ',CLASS=8,PRTY=9,TYPRUN=HOLD


6. NOTIFY - The NOTIFY parameter is used to direct the system, where it has to 
            send the success/failure message after completing the job.

    Syntax        ->  NOTIFY=userid/&SYSUID


    EXAMPLE JCL  ->  //MYJOB JOB (024),'NEERAJ',CLASS=8,NOTIFY=&SYSUID

                     &SYSUID - the userid from which user it has been submited 

                     //MYJOB JOB (024),'NEERAJ',CLASS=8,NOTIFY=BRM46

                     It send the sucess/failture message to BRM46 userid
 
 
 
JOBLIB / STEPLIB
 
 


JOBLIB

      It is a DD (Data definition) statement, and it specifies where 
      the program (which is specified in EXEC statement) exists. 
      It is applicable to all job steps in that job. It cannot be used 
      in cataloged procedures.

      Syntax  ->  //JOBLIB  DD  DSN=dataset

      EXAMPLE JCL ->
                         
                  //MYJOB   JOB   (024),'NEERAJ'  
                  //JOBLIB  DD    DSN=SE.TEST.LOADLIB,DISP=SHR    <---  NOTE
                  //STEP1   EXEC  PGM=COBPROG

                        
                 Immediately following the JOB statement is the JOBLIB DD 
                 statement. This is used to specify the location of the 
                 program that is to be executed.

 


STEPLIB

         It is also like JOBLIB. It is used to tell in which dataset 
  program resides, It will be coded in JOB STEP. It is only 
  for that step instead of entire JOB. It can be placed any 
  where in the job step. STEPLIB can be coded in cataloged procedures.

  

         Syntax  ->      //STEPLIB  DD  DSN=dataset

         Example JCL ->  //MYJOB   JOB   (024),'NEERAJ'
                         //STEP1   EXEC  PGM=COBPROG                                                 
                         //STEPLIB DD    DSN=TEST.MYPROD.LIB,DISP=SHR
                         //STEP2   EXEC  PGM=COBPROG2
                         //STEPLIB DD    DSN=TEST.MYPROD.LIB1,DISP=SHR

 I
In above example, STEP1 is executing COBPROG which is member of TEST.MYPROD.LIB                  
STEP2 is executing COBPROG2 which is member of TEST.MYPROD.LIB1
                        
 
 
EXEC STATEMENT 
  
EXEC statement is used to execute a program/procedure

                A maximum of 255 EXEC statement can code in an single job

                Syntax  - //stepname EXEC PGM=program-name,keyword parameters

                Positional parameter  -  Program-name


Keyword parameters for EXEC
  
            PARM  ACCT ADDRSPC DPRTY PERFORM RD

PARM

          PARAM parameter is used to pass information to program

          Syntax  ->  PARM=value
                 
          Value is a string can be 1 to 100 characters long.

          
          PASSING PARAMETER USING PARM PARAMETER 
 
 
 
 
ACCT    - accounting information for that step

ADDRSPC - used to indicate to the system that the job step is use either 
          virtual or real storage
 
DPRTY   - used to assign priority to the job step

PERFORM - specifies the rate at which system resources used by job step

RD      - restart definition is used to specify automatic restart of a job 
          if it abends 
 
 


No comments:

Post a Comment

Followers

Powered by Blogger.