JCL (shortly) is means of communication between a program that can be written in COBOL,Assembler or PL/I, and the MVS operating system in IBM Mainframes.

It is the interface between the requirements or instructions in our program, and the MVS operating system that the program will run in.
 

Without JCL,we can’t run our programs in batch Mode.

Why we need JCL ?
It is needed to  define the job  specify name of the program to be executed  Specify sequence in which programs to be  executed  describe the resources required by the programs  specify the requirements of the job like region,size,time limit ,priority etc…  provide accounting information  Operating System(OS) will get the information needed for execution of the job from JCL, and is executed.

Batch jobs

A job is a task or multiple related tasks to be executed by the system to accomplish user function. A job in a JCL contains related job steps. It can have up to 255 job steps.

Each job step in a job execute a program or procedure. The programs specified in your job are executed in the same sequence as specified

JCL statements
The three types of Job control statements: JOB,EXEC and DD statements. These 3 job control statements are building blocks of any JCL.  JOB statement: Begins or identifies a job in JCL and gives processing parameters for the Job.  EXEC statement : Begins or identifies the job step and specifies the program/procedure to be executed under the step.  DD statements : Defines resources required by the Job step.  There are many other types of JCL statements like PROC,PEND,comment,delimiter and NULL.

//STEP2 EXEC PGM=IDCAMS //INPUT DD DSN=…. ……………. .Structure of JCL //JOB 1 JOB … //STEP1 EXEC PGM=CR420P //INPUT DD DSN=….. //  end of job The JCL in this slide has one JOB and that job consists two job steps. ….

Once you complete the JCL.on ISPF panel.Open PDS member(JCL) in ISPF editor and type SUB/SUBMIT at COMMAND prompt in the ISPF editor 2.Then we can write your JCL. in ISPF editor. command prompt. as a member in the PDS with suitable name. 1.Writing and Running JCL  Usually JCLs are written as a member of a PDS.Allocate a PDS with record length of 80 and record format can submit your JCL for execution by following two methods. 2. . By typing TSO command TSO SUB <PDS member>.

and control their output processing The Job Entry Subsystem manages jobs before and after running the program JES uses SPOOL area for writing and reading . to SPOOL area or may be printed schedule them for processing by MVS.JES writes joblog and other data. as per user request.MVS and JCL  MVS uses a job subsystem(JES2 or JES3) to receive jobs in to the operating system.    .before and after the job execution After completion of job execution.

Once the job is submitted .JES takes up the responsibility and process the job.JCL .   • • • • • Phases in JES2 processing Input Processing Conversion Processing Execution Processing Output processing Purge Processing .Processing  Job progresses through different phases of JES processing.

JES2 converts the JCL and puts it on SPOOL data set and queues the job for execution assigns a job number to each job and places each jobs JCL onto the SPOOL datasets (Input queue) JES2 the queues the job in priority order for the next phase of processing Conversion Phase  JES2 converter scans JCL statements for Syntax error.execution Input Phase   JES2 reads the input stream .If any errors are present . .Input – Conversion . user gets notified and job is queued for output processing rather than execution.  If there are no errors.

for print processing. the output spool datasets to be printed .   After the execution. After processing all output for a job.  Execution phase In the execution phase.JES2 puts   . JES2 writes the system output(Joblog) and program outputs if requested JES2 then queues. Once the execution is completed JES takes over the processing. based on the priority the MVS initiator assigned to that class picks up the job and executes it.

JCL statements  Each JCL statement is logically divided in to 5 fields. IDENTIFIER FIELD NAME FIELD OPERATION FIELD PARAMETER FIELD COMMENTS FIELD      .

TEST. PRTY=6 ____________________________________ // STEP01 EXEC PGM=CR180P _____________________________________ // INPUT1 DD DSN=CH. ‘N SELVA’. CLASS=A. DISP=SHR ______________________________________ // REPORT01 DD SYSOUT=A _______________________________________ .INFL1.// Name operation operand comments ________________________________________ // JOB1 JOB (N189).

It consists of Column 1 & 2 // (except delimiter statement) Column 1 & 2 of the delimiter statement contain /* or two other chars designated. by the DLM parameter as delimiter for in-stream data Column 1.2 & 3 of a JCL comment statement contain //*     .IDENTIFIER field  It indicates to the system that statement is a JCL statement rather than data.

so that other statement and the system can refer to it. //INFILE1 DD… .@) characters… The first character must be an alphabetic or national The name must be followed by at least one blank //MYJOB JOB…. //STEP01 EXEC….#. Coding rules     The name must begin in column 3 The name is 1 thru 8 alphanumeric or national($.Name field The name field is identifier for JCL statement.

OPERATION field  The operation field specifies the type of JCL statement Operation field  follows the name field  Must be preceded and followed by at least one blank  Can contain pre-determined reserved word or chars based on the type of jcl statement like JOB.EXEC or DD  There are some special JCL statements without operation field like parameter & delimiter statements. .

Should not give any blanks between parameters The parameters field consists of positional and keyword parameters. parameters should be separated by comma. Some of these parameters are optional and some of them are mandatory.Parameters Field Through parameters we can supply details required for executing our job and to control the way your job is executed. .   • • • These fields are to be coded as: The parameters field follows the operation field It must be preceded and followed by at least one blank If multiple parameters are to be coded .

CLASS=A Training Job Continuation of comment filed COL pos 72 X //SELECT EXEC PGM=SAMPLE This line // demonstrates continuation of comment field .   //JOB1 JOB ACCT3. It is optional.’TRG’.by giving sufficient comments. This field is useful to make your jcl easily understandable .Comment Field  This field can be used for documenting the JCL.

TIME=2 | | POSITIONAL PARAMETERS KEYWORD PARAMETERS | | //ST1 EXEC PGM=P1.REGION=200K .Parameters field contd.  //JOB1 JOB ACT2.  All positional parameters must precede all keyword parameters. Each type of JCL statement is having fixed number of positional parameters..TRG.CLASS=A.

KP1=A.KP3=Y //SMT1 OPFLD PP1.PP3.KP3=Y. . Do not code the replacing comma if. The omitted positional parameter is the last positional parm All the following positional parameters are omitted All positional parameters are omitted    //SMT1 OPFLD PP1.code a comma to indicate the omitted parameter.Positional parameters  Must be coded first in the parameters field Must be coded in the specified order as per the statement syntax If we omit a positional parameter and code a following positional parameter.PP3.PP2.KP2=B.KP2=B..

NOTIFY=TRG01.Can be coded in any sequence 3. // MSGCLASS=X. Value could be fixed characters that must be coded or variable information.RD=R RD=R Here R is fixed character MSGCLASS=X. keyword parameters //JOB JOB ACT10.CLASS=A. 2.No need of comma to indicate the absence of a keyword parameter.Format: <keyword>=<value> Rules: X is the variable information .To be coded only after coding any positional parameters.

TRG10.TRG10.TIME=(1.  The sub-parameter list can consists of both positional and keyword sub-parameter.Sub-parameters-Positional A positional parameters or the variable information on a keyword parameters sometimes consists of more than one item.2) //JOB1 JOB (DBA.called a sub-parameter list.BATCH).TRG.N1).then omit the parenthesis or apostrophes  //JOB1 JOB (DBA.When a parameter contains more than one subparameter.If the list is.2) //JOB1 JOB DBA. Rules : 1.TIME=1 .N1.a single keyword sub-parameter or a single positional sub-parameter with no omitted preceding subparameters.enclose the sub-parameter list in parentheses 3.separate the sub-parameters by commas 2..TIME=(.

RECFM=FB) DCB=(RECFM=FB.containing keyword sub-parameters (LRECL.BLKSIZE=3200) DCB=(BLKSIZE=3200.LRECL=80.LRECL=80) DCB=LRECL=80 DCB is the keyword parameter on DD statement.BLKSIZE and DSORG).BLKSIZE=3200.Sub-parameters-Keyword DCB=(LRECL=80. It has sub-parameters list. .RECFM.

Mark the end of preceding job.through its parameter. It delimits the previous job when multiple jobs are stacked in input stream    . Tell the system how to process the job. when jobs are stacked in the output stream JOB statement is required in every job and must be in each job as the first statement The job statement supplies the processing requirements of the job.The JOB statement     JOB statement is used to Mark the beginning of a the system.

JOB statement - Name field
//Jobname JOB <parameters>….<comments> | name field The job name is mandatory for every job statement. On each job statement in a JCL it must be unique Must begin in column 3 after ‘//’ Is 1 thru 8 alphanumeric or national ($,#,@) characters.The first character must be alphabetic or national.
//QYGBC12 //C31249 //R45MR@67 //@12345

JOB Statement – Operation field


JOB… | Operation field:


  

Is used to specify the statement as Job statement Consists of the characters ‘JOB’ Must follow the Name field Should be preceded and followed by at least one blank space.

JOB statement – parameter field
Positional parameters:

Keyword Parameters:

Accounting Information: specifies the account number and other information required by the installation.
//JOB1 JOB (DBA,CAN,1,DTX99,TRG01),… //JOB1 JOB1 DBATRG,… Programmer Name: It is second positional parameter on JOB statement. - to identify the owner of the job - optional (may be mandatory for some installations) - Can be up to 20 characters including special chars. - Is coded immediately after the Accounting Information parameter and before the keyword parm - Should be enclosed in apostrophes ,if it contains special chars. //JOB2 JOB DBATRG,’SELVA KUMAR’,… //JOB3 JOB ‘SHANE O’’ HARA’,….

 . TIME TIME=([minutes] [.CLASS:  It is used to assign the JOB to a class.  Within job class group.seconds])  This parameter is used to specify the maximum length of time that a job is to use processor and to find out the actual time used through messages  The system terminates the job that exceeds the specified time limit.system selects the jobs in order of priority  It is a number from 0 through 15 for JES2.  It helps in optimal scheduling of the jobs at an installation  This parameter takes one character A thru Z or 0 thru 9 as job class and must be a valid Class defined by the installation at JES initialization PRTY: This is used to assign a selection priority to our job.

//JOB1 JOB ACT1. REGION REGION={valueK | valueM} It is used specify the amount of central or virtual storage that the job requires. Virtual is default.faster).ADDRSPC ADDRSPC={VIRT|REAL} It is used to indicate the system that the job requires virtual storage(which is pageable) or central storage(real storage . Multiple of Kilobytes or Megabytes. MSGCLASS=X MSGCLASS .is used to assign the job log to an output class.REGION=20M. The system applies the value that you code on REGION to each step of the step.’TRG’.The joblog is a record of job-related information for the Programmer.CLASS=A. .

NOTIFY=T41NS04.using MSGLEVEL parameter.system will notify the user who has submitted the job. .mentioned in the MSGCLASS. Joblog with selected information is directed to an output class.messages]) statements – To control the listing of JCL statements in joblog messages – To control the listing of JCL and JES messages in joblog. MSGLEVEL=([statements] [. //JOB1 JOB ACCT1. NOTIFY: Used to request the system to send a message to the specified TSO/E user-id when the background job complete processing...If not coded.MSGLEVEL: Details in the listing of the Joblog can be controlled.This is optional.CLASS=A.

system execute the job steps.LE) IF 4 <= RC BYPASS ELSE CONTINUE COND=((20.Else.COND parameter When this parameter is specified in the job statement. the system performs the COND parameter tests against the return codes from completed job steps.GE).all remaining job steps are bypassed and job gets terminated.operator)\ COND=(4.(30. before and after each job step is executed. COND=(code.If none of these tests is satisfied .LT))  any return code of 21 through 30 allows the job to continue .

procstepname. the RESTART facility allows the job to be re-run from a specific step. If a job abends . . Using this facility. we can avoid re-running the successfully completed steps of an abended job.RESTART=STEP2 The parameter value stepname. indicates that the system has to restart execution at the beginning of a step of the procedure called by the job step.CLASS=A. RESTART={(*) | (stepname)}  //JOB1 JOB ACCT1.RESTART parameter  This parameter is optional and used to indicate the step or procedure step at which the system is to restart a job.

If an error occurs during input services. HOLD . after particular event has occurred or if we want it to execute at later time. JES does not hold the JOB. so that operator will release the JOB for execution. This option can be used if the JOB is to be submitted.System holds the JOB before execution until operator releases it. .TYPRUN parameter TYPRUN={HOLD|SCAN} This parameter is optional and can be used to request the special job processing.but does not execute the job. after that event or time. SCAN – System only checks for the syntax errors in the Job’s JCL.


 Exec statement also specifies name to the step.    . Specify the program or procedure to be executed Pass the parameters to the processing program Tell the system how to process the program or procedure specified.Purpose of EXEC statement  Mark the beginning of each step in a job.

Where to code Exec statement?  EXEC statement is written after JOB statement in a it is always at the beginning of a step. EXEC statement also acts as a delimiter for any previous step in the job stream. EXEC statement starts the step in the job stream. There will be only one EXEC statement for a step in the JOB and the job may have several steps.    .

overriding parameters and adding DD statements to procedure step . for performing restart at or in the step.EXEC statement .should be unique .optional but is needed for referring to the step in later JCL statements.. <comments> | |-> name field It can be continued on to multiple lines Name field: It is used to specify name for the step so that this name can be used to refer back the step from any other step in the job .syntax //stepname EXEC <parameters>.

) .must begin in column in 3 immediately after the first two ‘//’ 1 through 8 alphanumeric or national($.@) characters. - Operation field - - is used to specify the statement as the EXEC statement Consists of the characters ‘EXEC’ Must follow the Name field Should be preceded and followed by at least one blank space .The first character must be alphabetic or national must be followed by at least one blank. Name field(contd….

preceded and followed by at least one blank and separated by commas. .parameter is used to specify the processing requirements for the step .Positional parameter ACCT ADDRSPC TIME PARM REGION COND <.follows the Operation field .keyword parameter .Parameter field //STEPNAME EXEC <parameters> PGM= OR PROC= <.

PROC or procedure name.Positional parameter of EXEC //STEP03 EXEC PGM=CR180P //PROC01 EXEC PROC=COMPILE //PROC01 EXEC COMPILE - is required to specify what program or procedure to be executed by this step - can contain one of positional parameters use - - - . is mandatory In case of programs .to use PGM= keyword In case of in-stream or catalogued procedure .

ACCT=(NS.Exec statement – key word parameters  Keyword parameters can be coded in any order in the parameter field after the positional parameters. Some parameters if not coded take value from corresponding JOB card parameter or installation default.   //STEP02 EXEC PGM=CR723H. Multiple keyword parameters should be separated by comma. PARM=’13/678’ .’B=3456’).47.

PARM=’25&&45’ //STEP4 EXEC PGM=P4. To use the information passed thru this parameter. This parameter provides a way for communication from JCL to program.The PARM parameter  This parameter is used to pass variable information (parameters) to the processing program executed by the job step.’25/10/96’) . the processing program must contain instructions to retrieve the information   //STEP3 EXEC PGM=P3.PARM=(10.

LE.STEP01).The COND parameter //STEP03 EXEC PGM=CR534.the system ignores ONLY or EVEN . This parameter can be used to specify special processing requirement using keyword EVEN or ONLY.this step is executed only if a preceding step is abended and return code of STEP01 is less than 4. If the operator terminated a job step with a CANCEL command. EVEN Specifies that this job is to be executed even if any preceding job step abnormally terminated. ONLY Specifies that this job step is to be executed only if a preceding job step abnormally terminated.COND=((4. ONLY) .

     . Specify resources needed for the dataset.DD statement It is used to  Define the resources required by the Job step and Job Describes INPUT and OUTPUT data sets required by JOB or Processing program. Specify dataset integrity processing required Request special processing A DD statement required for each dataset referred by processing program for the step.

…………  DD statements required for the step are coded soon after EXEC statement. which begins the step  We have to code DD statements for all the files referred by the processing program in the step. and any special DD statements if special processing is required JOBLIB & STEPLIB are the special DD statements will be coded to locate the resources required for the whole JOB & step respectively.  .Where to code DD statements? //JOB1 JOB ACT1.NOTIFY=TRG014 //STEP1 EXEC PGM=P1 //DD1 DD… //DD2 DD….

DATA.syntax //ddname DD <parameter>. parameters and field Do not code comments fields.SELVA.DISP=SHR  A DD statement can have five fields just like other JCL statements. It consists of // in column 1 & (DD).DD statement .<comments> //INFILE1 DD DSN=TEST. if the parameter field is blank   ..

Must be followed by at least one blank      . Is 1 through 8 alphanumeric or national characters and must begin with alphabet or national character. Each ddname should be unique within the job step.DD statement – name field  It represents ddname. It must begin in column 3. It is basically the logical filename referred by the processing program.

DD statement – Operation field //INDD //OUTDD DD …. DD . .. Is used to specify the statement as DD statement Consists of the characters must follow the Name field Should be preceded and followed by at by least one blank space.

Specification of name for data DSN Specification of temporary dataset &&name Specification of permanent dataset Data-set-name Specification of the action performed DISP on the data: sub-parameters .Allow shared access SHR _______________________________________________ .Create if it does not exist.Function Corresponding JCL parameter and ___________________________________sub-parameter_ Specification of name for ddname DD statement.Create new data NEW .Use pre-existing data OLD .add MOD records at the end if it exists .reserve for exclusive use OLD .

Function Corresponding JCL parameter and ___________________________________sub-parameter_ Specification of the following DISP actions to be implemented on data after successful execution Sub-parameters of job: Delete DELETE Don’t delete KEEP Catalog CATLG Send to job step PASS Uncatalog UNCATLG ________________________________________________________ Specification of action to be DISP Performed in case of job abended .Delete DELETE Don’t delete KEEP Catalog CATLG Uncatalog UNCATLG ________________________________________________________ .

DUMMY <Positional parameters DSN SPACE UNIT LABEL DISP VOLUME DCB <. Should be preceded and followed by at least one blank Multiple parameters should be separated by commas.parameters *. DLM .DD statement . . DATA .Keyword parameters All the parameters on DD statement are optional.


UNIT and DCB . is supplied through the DD statement Parameters: DSNAME and DISP which we discussed and SPACE.VOL.Parameters required for new data set  For a new data set. following parameters are required to create: DSN DISP SPACE DCB VOLUME UNIT The information required for creating data set in JCL.

10.CATLG).RLSE.ROUND) .(9.X1.RLSE][.} (PRQTY[.MXIG) SPACE=(1024.DIR])[.SECQTY])[.RLSE) SPACE=(TRK. DISP=(.} {BLKLEN.SPACE Parameter  Syntax : SPACE = ({TRK ..} measurement unit no of units special processing request //DD1 DD DSN=TRG.CONTIG] [.(10.2).ROUND]) {CYL.5).5.DATAOUT.SPACE=(CYL.

Requests that space be allocated in tracks BLKLEN . TRK CYL . in bytes.Request that space allocation .The system computes how many tracks to allocate.Sub-parameter 1 (TRK|CYL|BLKLEN) This parameter is used to request space for a New dataset. .Specifies the average block length.The blklen is a decimal number from 1 through 65535.

So . PRQTY (Primary Quantity) Specifies the number of tracks or cylinders or data blocks to be allocated SECQTY (Secondary Quantity) Specifies the number of additional is allocated only when it is needed DIR Specifies the number of directory blocks needed in case of PDS . cylinders or data blocks to be allocated.if more space is needed.SPACE – parameter contd.

ALX – Requests that up to five separate areas of contiguous space are to be allocated to the data set and each area must be equal/greater than the primary quantity. CONTIG or MXIG or ALX This sub-parameter affects only primary space allocation: CONTIG – Requests that space allocated to data set must be contiguous MXIG – Requests that space allocated to the data set must be the largest area of available contiguous space on the volume and equal to or greater than the primary quantity.RLSE Requests that space allocated to an output data set. is to be released when the data set is closed. . but not used.

TEST.RLSE.ROUND) . request that space allocated to the dataset must be equal to an integral number of cylinders //DD4 DD DSN=CH.ROUND When the first sub-parameter specifies the block length.OUTPUT.5). // SPACE=(TRK.(10.

)} This parameter is used to specify the volume or volumes on which. a specific volume by volume serial number or a volume that another data set uses  We can also specify which volume of the multi-volume data set is to be processed first We can specify number of volumes required for a output data set  . the new data set will reside or the existing dataset reside. Using this parameter :  We can request.vol-count][.RETAIN][.{SER=(ser-no[.vol-seq-number] [.ser-no].VOLUME parameter VOLUME=([PRIVATE][..

VOLUME . requests a private volume.then it requests that :  for a PRIVATE tape volume. that this volume is to be retained at the device if it is de-mounted during the job RETAIN is supported only for tape volumes.sub parameters PRIVATE – is optional and if PRIVATE is coded . RETAIN – is optional and if RETAIN is coded .will be ignored.If coded for DASD .   . for a public tape volume .that the volume is not to be de-mounted or rewound after closing of the dataset .

it will be 1 thru 6. system assigns the new data set to the same volume used by the data specified by dsname *.ddname – keyword parameter dsname – names a dataset . REF=dsname or *.Vol-seq-number  VOL=SER=DEV01 Identifies the volume of an existing multi-volume data set to be used to begin processing the data set.dsname – asks the system to obtain the vol ser no from earlier dd statement in the same job step. .  is a decimal no from 1 thru 255  is ignored for new datasets Volume count. Specifies the maximum no of volumes that an output dataset requires SER=serial-number – keyword parameter Identifies by serial no of the volume(s) on which the dataset resides or will reside.

CATLG).DISP=(NEW.unit-count][. // UNIT=3380 device type .U1.UNIT parameter This parameter can be used to ask the system to place the data set on:  a specific device  certain type or group of devices  same device as another dataset UNIT=({[device-number][device-type][groupname]} {[.DEFER]) or UNIT=AFT=ddname UNIT=(3380.2) 2 devices required UNIT=AFF=DD1 requests same two devices as DD1 //DD1 DD DSN=TRG1.p]} [.

RECFM=FB.DCB parameter Used to provide information concerning the Data Control Block(DCB) for a data set DCB=(LRECL=nn[.RECFM=z] [.Code PS for physical sequential and PO for partitioned RECFM .Fixed Record length and blocked VB .specifies record format and blocking factor FB .Variable record length & blocked U .Undefined record Format .BLKSIZE=yy][.BLKSIZE=800)  LRECL – specifies the logical record length DSORG – specifies the data set organization.DSORG=mm]) DCB=(LRECL=80.

DISP=(.LABEL parameter LABEL = (Dataset-sequence-number [.RETPD=180) LABEL==EXPDT=2000/325 .expiration date and retention period for the dataset //DD1 DD DSN=TEST.IN|OUT] [.to the open data set only for input or output .NSL.MYTAPE.DS.PASSWORD | NOPWREAD] [.password protection .type and contents of the label(s) for the dataset . // LABEL=(3.UNIT=TAPE.RETPD=nnn | EXPDT=(yyddd|yyyy|ddd)] Used to specify for a tape or Direct access data set: .CATLG).label-type] [.

SYSOUT parameter //PRINTOUT DD SYSOUT=* //MSGOUT DD SYSOUT=* .is used to identify this data set as system output dataset and assign this SYSOUT dataset to an output class. .we can request to assign SYSOUT data set to an output class same as class of MSGCLASS parameter on the JOB statement .If a SYSOUT data set has the same class as the JOB statement MSGCLASS parameter.the job log appears on the same output listing as this SYSOUT dataset. .

  . This can be used to suppress reference to or output to any data set.system bypass all I-O requests against that file.  If coded DUMMY should be the first parameter coded because it is positional is not required. This parameter also can be used to suppress any output generated by program.DUMMY dataset //SYSPRINT DD DUMMY //SYSIN DD DUMMY  Specifying DUMMY as parameter.

//DD2 DD DSN=&&TMP(&MEN1).TEMPORARY datasets //DD1 DD DSN=&&TEMPDSN.UNIT=TEMPDA ……………………………………………………….UNIT=TEMPDA  We can use temporary datasets as work file for sort .followed by a character string of 1 to 8 characters in length and the first character must be alphabetic or   . Temporary datasets are created at the beginning of the JOB and unconditionally deleted at the end of a job To use two ampersands (&&)..

private libraries and datasets for storage dumps and checkpoints .Special DD names //JOBLIB //STEPLIB //SYSMDUMP //SYSUDUNP //SYSABEND //SYSIN The special DD statements are used to specify private catalogs.

Private library is applicable to all steps within that Job Statement can specify more than one private library by concatenating multiple private libraries. Must be the DD statement immediately following the EXEC statement .JOBLIB & STEPLIB JOBLIB    Must be the DD statement immediately following the JOB statement . Private library is applicable only to that step Job library is ignored for that step and system searches the private library specified by STEPLIB STEPLIB    .

. .. you can use them in your job steps testing your program. DD . //SYSABEND DD SYSOUT=* dump of system and user area //SYSDUMP DD SYSOUT=A Formatted dump of user areas //SYSMDUMP DD DSN=TRG..if the step terminates abnormally.DUMP dump of system area // DISP=OLD These DD statements can be used in a job step to direct the system to produce a dump. These dumps may help in debugging by providing more information about abend. So.NOTIFY=TRGXXX MSGCLASS=X //ST1 EXEC PGM=P1 //..//J1 JOB A1.CLASS=A. The system produces the requested dump.

SYSIN dd statement //SYSIN DD * 120199 In-stream Data /* //SYSIN DD DATA.SYSIN is default DD name for instream data  .DLM=** 120799 In-stream data **  Used to begin an in-stream data set  In-stream datasets begin with DD * or DATA statement The in-stream data sets can have any valid ddnames including SYSIN.

D1.DISP=SHR //STD2 DD DSN=*.CLASS=A //ST1 EXEC PGM=P1 //D1 DD DSN=XX.BACKWARD REFERENCING //JOB1 JOB or *.ST1 //STD1 DD DSN=XX. // DISP=DHR  A backward reference is a reference to an earlier statement in the job or in a catalogued or in-stream procedure called by the job step.D2.stepname. *.ST1.DISP=*. //ST2 EXEC PGM=*.ddname – where the  .DISP=SHR //D2 DD DSN=YY.

DISP=SHR DD DSN=TRG2.DISP=OLD Concatenation is grouping or connecting a set of separate physical or partition data to a single logical data set.DISP=SHR DD DSN=TRG1.DISP=OLD DD DSN=TRG2.CONCATENATION //TRGDS // // //  DD a that system will search all of them as a single library.DS2.DS2. .DS1. Each of the concatenated data set can reside on different volume.DS1.So.that the reference to the logical dataset results in reference to all separate data sets connected to it.   This is mostly used to concatenate different libraries together.

.DLM=AA …….Special JCL statements Comment statement //* This is a comment line  NULL statement // <. AA <.to mark end of job  Delimiter statement //INDD DD *.end of in-stream data //INFILE DD * …data……  .data………..

prepare sets of job control statement as procedures.ends procedure       Jcl procedure is a set of JCL statements .JCL Procedure //PROC1 PROC <. A procedure may call other procedures We can even modify parts of procedures. //PROC1 PEND <.that perform a routine or general function A procedure can contain multiple number of steps For jobs that we run frequently or types of jobs that use the same job control.begins procedure ……… jcl statements … ………. .

which is JCL procedure library called as EXTERNAL or CATALOGUED procedures  .Where to write JCL procedures  In the JCL where it is used as IN-STREAM procedures (the proc will be coded before the proc executing statement ) Or as a member of the PDS.

IN-STREAM Procedure Will be written usually PROC and PEND statements. PROC – begin tag of the procedure PEND – the end tag  A JCL procedure can not include the following .JES statements  To invoke the procedure //S1 EXEC PROC=PROC1 after describing the in-stream procedure .JOBLIB statement .In-stream data .Job statement and Null statement .

Catalogued Procedure  Is a procedure that you catalogued in a library  The library containing catalogued procedures is a PDS. We can have our own procedure library. A catalogued procedure can be used by multiple jobs simultaneously.PROCLIB.   //procname PROC [parameters] [comment] //ST1 EXEC PRC1 (calling procedure PRC1) .The system procedure library is SYS1.

Overriding or nullifying DD statements .adding DD statements  The interesting thing is that we can add DD statements to a procstep by override feature.Using symbolic parameters . .Modifying procedure  Procedures can be modified by: .Overriding or nullifying parameters .

Symbolic parameter consists of an ampersand(&) followed by a name which is 1 thru 7 alphanumeric or national characters. We can assign values to symbolic parameters in PROC statement or in the EXEC statement of the invoked procedures.The first character must be alphabetic or national. Any parameter .a parameter.Symbolic Parameters  It can stand as a symbol for any information in the parameter field of a statement . s subparameter or a value.sub-parameter.or value in a JCL statement that can vary each time the job is executed is a good candidate to be coded as s symbolic parameter.    .

there will not be any problem .MN=M  We can nullify a parameter value by not assigning any value to the symbolic parameter.IN.DS=TRGIT.//PRS PROC MN=EDIT.DISP=SHR //PEND end of procedure PRS Invoking procedure with Symbolic Parameters //SX EXEC PRS.123’ //S1 EXEC PGM=P1.  .P1=‘XX’. so that even if the symbolic parameter P1 is nullified .DSP=.(as shown in the slide for DSP parameter) In this example.Comma is included in the value for symbolic parameter P2.DISP=&DSP //DD2 DD DSN=&DS..PDS(&MN).PARM=(&P1&P2) //DD1 DD DSN=&DS.P2=‘.P1 and P2 stands for positional parameter values in PARM parameter..

IN.TIME=2.REGION=.TIME=2.ACCT=PR1.REGION=2K. .Modifying EXEC parameters //MP PROC //S1 EXEC PGM=P1.REGION=1K.ACCT=TR1 //DD1 DD DSN=TRG1T. // ADDRSPC=REAL.PARM=‘121299’.DISP=SHR //DD2 DD SYSOUT=* //S2 EXEC PGM=P2.TIME=1. Here. • ACCT parameter on both the steps of procedure is modified to PR1 • REGION parameter for both steps in procedure is nullified • ADDRSPC parameter is added to both the steps in procedure • PARM parameter is added only to first step(S1) of the procedure.S2.ACCT=TR2 //DD2 DD SYSOUT=* //PEND //JS1 EXEC MP .

Override full parameter.. .Rules and Order RULES and order of overriding 1.. .then the second step. 3.etc 4.The modifying parameters should be in the following order.A PARM parameter without a procstepname qualifier applies only to first procedure step. .All parameters modifying first step.then third.Parameter without PROC step qualifier.Do not override PGM parameter 2.

NOTIFY=TRGR01 //ST1 PR1 //S1.D3 DD SYSOUT=* .DISP=SHR //A3 DD DUMMY //S2 EXEC PGM=P2 //D1 DD DSN=TRG1 //D2 DD DUMMY Job calling the procedure PR1.DISP=OLD //S2.A1 DD SYSOUT=* //S1. //J1 JOB TR.D1 DD DISP=OLD //S2.OU.A3 DD DSN=TR3. .CLASS=A.Overriding of DD statements Proc PR1 //S1 EXEC PGM=P1 //A1 DD SYSOUT=A //A2 DD DSN=TRG1.

even though only part of the overridden parameter is being changed. We code the overriding statements after the EXEC statement of proc calling in the JOB.ddname DD parameters   Parameters on the overriding statement that are not coded on the procedure statement are added to the procedure statement.DD Overriding………  We can override .nullify or add parameters to DD statements in the procedure and also we can add DD statements to the procedure step.  //procstepname. An entire overriding parameter must be coded. .

Order of Overrides  Override statements with qualifier can appear in any order Override statements without qualifier must be in same order as in procedure Adding statements must follow all override statements    For all procedure steps in the invoked procedure place the modifying statements for each procedure step in the same order in which the procedure steps are specified. .

  . an EXEC statement may invoke another procedure .Nested Procedures  Catalogued and in-stream procedures can invoke other procedures (up to 15 levels of nesting).which contains an EXEC statement to invoke another procedure. If recursion occurs in nested procedures then expansion of JOB stream fails as expansion of nesting and JCL errors occurs. An in-stream procedure can not be defined within another procedure.The submission will end with JCL error.  In a procedure .