0% found this document useful (0 votes)
378 views89 pages

JCL

The document discusses Job Control Language (JCL) which is used to communicate between programs and the MVS operating system on IBM mainframes. JCL defines the job, specifies the program to run, resources needed, and provides accounting information. The main JCL statements are JOB, EXEC, and DD which identify the job, steps, and data requirements. JCL is written in a partitioned data set and submitted to run programs in batch mode.

Uploaded by

Rajesh Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
378 views89 pages

JCL

The document discusses Job Control Language (JCL) which is used to communicate between programs and the MVS operating system on IBM mainframes. JCL defines the job, specifies the program to run, resources needed, and provides accounting information. The main JCL statements are JOB, EXEC, and DD which identify the job, steps, and data requirements. JCL is written in a partitioned data set and submitted to run programs in batch mode.

Uploaded by

Rajesh Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 89

JOB CONTROL LANGUAGE

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

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

Writing and Running JCL

Usually JCLs are written as a member of a PDS.

1.Allocate a PDS with record length of 80 and record format FB. 2.Then we can write your JCL, as a member in the PDS with suitable name, in ISPF editor.

Once you complete the JCL,you can submit your JCL for execution by following two methods.
1.Open PDS member(JCL) in ISPF editor and type SUB/SUBMIT at COMMAND prompt in the ISPF editor 2. By typing TSO command TSO SUB <PDS member>,on ISPF panel,at command prompt.

MVS and JCL

MVS uses a job subsystem(JES2 or JES3) to receive jobs in to the operating system,to schedule them for processing by MVS, 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 ,before and after the job execution After completion of job execution,JES writes joblog and other data, as per user request, to SPOOL area or may be printed directly.

JCL - Processing

Job progresses through different phases of JES processing. Once the job is submitted ,JES takes up the responsibility and process the job.

Phases in JES2 processing Input Processing Conversion Processing Execution Processing Output processing Purge Processing

Input Conversion - execution


Input Phase

JES2 reads the input stream ,it 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.If any errors are present , user gets notified and job is queued for output processing rather than execution. If there are no errors, JES2 converts the JCL and puts it on SPOOL data set and queues the job for execution phase.

Execution phase In the execution phase, based on the priority the MVS initiator assigned to that class picks up the job and executes it. Once the execution is completed JES takes over the processing.

After the execution, JES2 writes the system output(Joblog) and program outputs if requested JES2 then queues, the output spool datasets to be printed , for print processing.
After processing all output for a job,JES2 puts

JCL statements

Each JCL statement is logically divided in to 5 fields.


IDENTIFIER FIELD NAME FIELD OPERATION FIELD PARAMETER FIELD COMMENTS FIELD

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

IDENTIFIER field

It indicates to the system that statement is a JCL statement rather than data. 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 //*

Name field
The name field is identifier for JCL statement, so that other statement and the system can refer to it. Coding rules

The name must begin in column 3 The name is 1 thru 8 alphanumeric or national($,#,@) characters The first character must be an alphabetic or national The name must be followed by at least one blank

//MYJOB JOB. //STEP01 EXEC. //INFILE1 DD

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.

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 , parameters should be separated by comma. Should not give any blanks between parameters

The parameters field consists of positional and keyword parameters.


Some of these parameters are optional and some of them are mandatory.

Comment Field

This field can be used for documenting the JCL. It is optional. This field is useful to make your jcl easily understandable ,by giving sufficient comments.

//JOB1 JOB ACCT3,TRG,CLASS=A Training Job Continuation of comment filed COL pos 72 X

//SELECT EXEC PGM=SAMPLE This line // demonstrates continuation of comment field

Parameters field contd..

All positional parameters must precede all keyword parameters. Each type of JCL statement is having fixed number of positional parameters.

//JOB1 JOB ACT2,TRG,CLASS=A,TIME=2 | |


POSITIONAL PARAMETERS KEYWORD PARAMETERS

| | //ST1 EXEC PGM=P1,REGION=200K

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,code a comma to indicate the omitted parameter. 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,PP2,PP3,KP1=A,KP2=B,KP3=Y //SMT1 OPFLD PP1,,PP3,KP3=Y,KP2=B,

Format: <keyword>=<value> Rules: 1.To be coded only after coding any positional parameters. 2.Can be coded in any sequence 3.No need of comma to indicate the absence of a keyword parameter.
Value could be fixed characters that must be coded or variable information.

keyword parameters

//JOB JOB ACT10,CLASS=A,NOTIFY=TRG01, // MSGCLASS=X,RD=R


RD=R Here R is fixed character MSGCLASS=X,here X is the variable information

Sub-parameters-Positional
A positional parameters or the variable information on a keyword parameters sometimes consists of more than one item,called a sub-parameter list. The sub-parameter list can consists of both positional and keyword sub-parameter. Rules : 1.When a parameter contains more than one subparameter,separate the sub-parameters by commas 2.enclose the sub-parameter list in parentheses 3.If the list is,a single keyword sub-parameter or a single positional sub-parameter with no omitted preceding subparameters,then omit the parenthesis or apostrophes

//JOB1 JOB (DBA,TRG,TRG10,N1,BATCH),TIME=(1,2) //JOB1 JOB (DBA,,TRG10,N1),TIME=(,2) //JOB1 JOB DBA,TIME=1

Sub-parameters-Keyword
DCB=(LRECL=80,BLKSIZE=3200,RECFM=FB)

DCB=(RECFM=FB,LRECL=80,BLKSIZE=3200)
DCB=(BLKSIZE=3200,LRECL=80) DCB=LRECL=80

DCB is the keyword parameter on DD statement. It has sub-parameters list,containing keyword sub-parameters (LRECL,RECFM,BLKSIZE and DSORG).

The JOB statement

JOB statement is used to


Mark the beginning of a job. Tell the system how to process the job. Mark the end of preceding 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,to the system,through its parameter. It delimits the previous job when multiple jobs are stacked in input stream

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

//MYJOB JOB

JOB | Operation field:

//JOB1

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:
ACCOUNT-PARAMETER PROGRAMMER NAME

Keyword Parameters:
CLASS PRTY MSGCLASS MSGLEVEL REGION TYPRUN COND NOTIFY RESTART ADDRSPC TIME

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

CLASS: It is used to assign the JOB to a class. 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. Within job class group,system selects the jobs in order of priority It is a number from 0 through 15 for JES2. TIME TIME=([minutes] [,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.

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 ,faster). Virtual is default. REGION REGION={valueK | valueM} It is used specify the amount of central or virtual storage that the job requires. The system applies the value that you code on REGION to each step of the step. Multiple of Kilobytes or Megabytes. //JOB1 JOB ACT1,TRG,CLASS=A,REGION=20M, MSGCLASS=X MSGCLASS - is used to assign the job log to an output class.The joblog is a record of job-related information for the Programmer.

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

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

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 a job abends , the RESTART facility allows the job to be re-run from a specific step. Using this facility, we can avoid re-running the successfully completed steps of an abended job. RESTART={(*) | (stepname)}

//JOB1 JOB ACCT1,CLASS=A,RESTART=STEP2 The parameter value stepname.procstepname, indicates that the system has to restart execution at the beginning of a step of the procedure called by the job step.

TYPRUN parameter
TYPRUN={HOLD|SCAN} This parameter is optional and can be used to request the special job processing. SCAN System only checks for the syntax errors in the Jobs JCL,but does not execute the job.

HOLD - System holds the JOB before execution until operator releases it. If an error occurs during input services, JES does not hold the JOB. This option can be used if the JOB is to be submitted, after particular event has occurred or if we want it to execute at later time, so that operator will release the JOB for execution, after that event or time.

JOB statement examples


//TRGR02X JOB (TRG,GEN,TRGR02,AA,DT99X),TRG, // CLASS=B,MSGCLASS=X,NOTIFY=TRGR02

//SSGSEL1 JOB (SSG,D2,SSGSEL,D2,DT000), // SSG-DB2,CLASS=B, batch spufi for SSG DB2 // MSGCLASS=X,NOTIFY=SSGSEL

//GEMT01XX JOB (GEM,CIC,GEMT01,D2,DT99X), // GEM-PROJ,CLASS=C,MSGLEVEL=(1,1), // MSGCLASS=X,NOTIFY=GEMT01

Purpose of EXEC statement

Mark the beginning of each step in a job.

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.

Where to code Exec statement?

EXEC statement is written after JOB statement in a JOB. EXEC statement starts the step in the job stream,so it is always at the beginning of a step. EXEC statement also acts as a delimiter for any previous 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.

EXEC statement - syntax


//stepname EXEC <parameters>.. <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

- optional but is needed for referring to the step in later JCL statements, for performing restart at or in the step,overriding parameters and adding DD statements to procedure step - should be unique

Name field(contd.)
- must begin in column in 3 immediately after the first

two // - is 1 through 8 alphanumeric or national($,#,@) characters.The first character must be alphabetic or national must be followed by at least one blank.

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

Parameter field
//STEPNAME EXEC <parameters> PGM= OR PROC= <- Positional parameter ACCT ADDRSPC TIME PARM REGION COND <- keyword parameter

- parameter is used to specify the processing requirements for the step - follows the Operation field - preceded and followed by at least one blank and separated by commas.

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 PGM,PROC or procedure name.


is mandatory In case of programs ,to use PGM= keyword In case of in-stream or catalogued procedure ,to use

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. Multiple keyword parameters should be separated by comma.

//STEP02 EXEC PGM=CR723H,ACCT=(NS,47,B=3456), PARM=13/678

The PARM parameter

This parameter is used to pass variable information (parameters) to the processing program executed by the job step. This parameter provides a way for communication from JCL to program. To use the information passed thru this parameter, the processing program must contain instructions to retrieve the information

//STEP3 EXEC PGM=P3,PARM=25&&45 //STEP4 EXEC PGM=P4,PARM=(10,25/10/96)

The COND parameter


//STEP03 EXEC PGM=CR534,COND=((4,LE,STEP01), ONLY) - this step is executed only if a preceding step is abended and return code of STEP01 is less than 4. This parameter can be used to specify special processing requirement using keyword EVEN or ONLY. 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. If the operator terminated a job step with a CANCEL command,the system ignores ONLY or EVEN

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 resources needed for the dataset. Specify dataset integrity processing required Request special processing A DD statement required for each dataset referred by processing program for the step.

Where to code DD statements?


//JOB1 JOB ACT1,NOTIFY=TRG014 //STEP1 EXEC PGM=P1 //DD1 DD //DD2 DD. 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.

DD statement - syntax
//ddname DD <parameter>..<comments>
//INFILE1 DD DSN=TEST.SELVA.DATA,DISP=SHR

A DD statement can have five fields just like other JCL statements. It consists of // in column 1 & 2,name,operand (DD), parameters and field Do not code comments fields, if the parameter field is blank

DD statement name field

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

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.

Function

Corresponding JCL parameter and ___________________________________sub-parameter_

Specification of name for ddname DD statement. 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 - Create new data NEW - Use pre-existing data OLD - Create if it does not exist,add MOD records at the end if it exists - reserve for exclusive use OLD - Allow shared access SHR _______________________________________________

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 Dont 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 Dont delete KEEP Catalog CATLG Uncatalog UNCATLG ________________________________________________________

DD statement - parameters
*, DLM , DATA , DUMMY <Positional parameters

DSN SPACE UNIT LABEL

DISP VOLUME DCB

<- Keyword parameters

All the parameters on DD statement are optional. Should be preceded and followed by at least one blank

Multiple parameters should be separated by commas.

DISP parameter defaults


DISP coded DD statement No DISP parameter DISP=SHR DISP=OLD DISP=(,CATLG) DISP=(OLD,,DELETE) System Interpretation

DISP=(NEW,DELETE,DELETE) DISP=(SHR,KEEP,KEEP) DISP=(OLD,KEEP,KEEP) DISP=(NEW,CATLG,CATLG) DISP=(OLD,KEEP,DELETE)

DISP=MOD(treated as New) DISP=(MOD,DELETE,DELETE) DISP=MOD(treated as old) DISP=(MOD,KEEP,KEEP)

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, is supplied through the DD statement Parameters: DSNAME and DISP which we discussed and SPACE,VOL,UNIT and DCB

SPACE Parameter

Syntax :
SPACE = ({TRK ,} (PRQTY[,SECQTY])[,DIR])[,RLSE][,CONTIG] [,ROUND]) {CYL,} {BLKLEN,}
measurement unit no of units special processing request

//DD1 DD DSN=TRG.X1.DATAOUT, DISP=(,CATLG),SPACE=(CYL,(10,5),RLSE) SPACE=(TRK,10,RLSE,MXIG) SPACE=(1024,(9,5,2),,ROUND)

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

SPACE parameter contd..


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

RLSE Requests that space allocated to an output data set, but not used, is to be released when the data set is closed. 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. 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.

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

VOLUME parameter
VOLUME=([PRIVATE][,RETAIN][,vol-seq-number] [,vol-count][,{SER=(ser-no[,ser-no]..)}

This parameter is used to specify the volume or volumes on which, the new data set will reside or the existing dataset reside. Using this parameter :

We can request, 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

VOLUME - sub parameters


PRIVATE is optional and if PRIVATE is coded , requests a private volume.

RETAIN is optional and if RETAIN is coded ,then it requests that :

for a PRIVATE tape volume,that the volume is not to be de-mounted or rewound after closing of the dataset . for a public 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.If coded for DASD ,will be ignored.

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. 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.it will be 1 thru 6. REF=dsname or *.ddname keyword parameter dsname names a dataset . system assigns the new data set to the same volume used by the data specified by dsname *.dsname asks the system to obtain the vol ser no from earlier dd statement in the same job step.

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]} {[,unit-count][,p]} [,DEFER]) or UNIT=AFT=ddname
UNIT=(3380,2) 2 devices required UNIT=AFF=DD1 requests same two devices as DD1 //DD1 DD DSN=TRG1.U1,DISP=(NEW,CATLG), // UNIT=3380 device type

DCB parameter
Used to provide information concerning the Data Control Block(DCB) for a data set DCB=(LRECL=nn[,BLKSIZE=yy][,RECFM=z] [,DSORG=mm]) DCB=(LRECL=80,RECFM=FB,BLKSIZE=800)

LRECL specifies the logical record length DSORG specifies the data set organization.Code PS for physical sequential and PO for partitioned RECFM - specifies record format and blocking factor FB - Fixed Record length and blocked VB - Variable record length & blocked U - Undefined record Format

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

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.

DUMMY dataset
//SYSPRINT DD DUMMY //SYSIN DD DUMMY

Specifying DUMMY as parameter,system bypass all I-O requests against that file.

If coded DUMMY should be the first parameter coded because it is positional parameter.
This can be used to suppress reference to or output to any data set. This parameter also can be used to suppress any output generated by program,it is not required.

TEMPORARY datasets
//DD1 DD DSN=&&TEMPDSN,UNIT=TEMPDA .
//DD2 DD DSN=&&TMP(&MEN1),UNIT=TEMPDA

We can use temporary datasets as work file for sort ,. Temporary datasets are created at the beginning of the JOB and unconditionally deleted at the end of a job To use two ampersands (&&),followed by a character string of 1 to 8 characters in length and the first character must be alphabetic or

Special DD names
//JOBLIB //STEPLIB //SYSMDUMP //SYSUDUNP //SYSABEND

//SYSIN
The special DD statements are used to specify private catalogs,private libraries and datasets for storage dumps and checkpoints

JOBLIB & STEPLIB


JOBLIB

Must be the DD statement immediately following the JOB statement . 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 . 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

//J1 JOB A1,CLASS=A,NOTIFY=TRGXXX MSGCLASS=X //ST1 EXEC PGM=P1 //,,, DD ,,, //SYSABEND DD SYSOUT=* dump of system and user area //SYSDUMP DD SYSOUT=A Formatted dump of user areas //SYSMDUMP DD DSN=TRG.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. The system produces the requested dump,if the step terminates abnormally. These dumps may help in debugging by providing more information about abend. So, you can use them in your job steps testing your program.

SYSIN dd statement
//SYSIN DD * 120199 In-stream Data /* //SYSIN DD 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.SYSIN is default DD name for instream data

BACKWARD REFERENCING
//JOB1 JOB AC1.CLASS=A //ST1 EXEC PGM=P1 //D1 DD DSN=XX,DISP=SHR //D2 DD DSN=YY,DISP=*.D1, //ST2 EXEC PGM=*.ST1 //STD1 DD DSN=XX,DISP=SHR //STD2 DD DSN=*.ST1.D2; // 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. *.name or *.stepname.ddname where the

CONCATENATION
//TRGDS // // //

DD DSN=TRG1.DS1,DISP=SHR DD DSN=TRG1.DS2,DISP=SHR DD DSN=TRG2.DS1,DISP=OLD DD DSN=TRG2.DS2,DISP=OLD

Concatenation is grouping or connecting a set of separate physical or partition data to a single logical data set.So,that the reference to the logical dataset results in reference to all separate data sets connected to it,as a group.

This is mostly used to concatenate different libraries together,so that system will search all of them as a single library. Each of the concatenated data set can reside on different volume.

Special JCL statements


Comment statement //* This is a comment line

NULL statement // <- to mark end of job

Delimiter statement //INDD DD *,DLM=AA ..data.. AA <- end of in-stream data //INFILE DD * data

JCL Procedure
//PROC1 PROC <- begins procedure jcl statements . //PROC1 PEND <- ends procedure

Jcl procedure is a set of JCL statements ,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,prepare sets of job control statement as procedures. A procedure may call other procedures We can even modify parts of 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,which is JCL procedure library called as EXTERNAL or CATALOGUED procedures

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 - Job statement and Null statement - In-stream data - JOBLIB statement - JES statements

To invoke the procedure //S1 EXEC PROC=PROC1 after describing the in-stream procedure

Catalogued Procedure

Is a procedure that you catalogued in a library

The library containing catalogued procedures is a PDS.The system procedure library is SYS1.PROCLIB.
We can have our own procedure library. A catalogued procedure can be used by multiple jobs simultaneously.

//procname PROC [parameters] [comment] //ST1 EXEC PRC1 (calling procedure PRC1)

Modifying procedure

Procedures can be modified by: - Using symbolic parameters - Overriding or nullifying parameters - Overriding or nullifying DD statements - adding DD statements

The interesting thing is that we can add DD statements to a procstep by override feature.

Symbolic Parameters

It can stand as a symbol for any information in the parameter field of a statement ,a parameter, s subparameter or a value. Any parameter ,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. Symbolic parameter consists of an ampersand(&) followed by a name which is 1 thru 7 alphanumeric or national characters.The first character must be alphabetic or national. We can assign values to symbolic parameters in PROC statement or in the EXEC statement of the invoked procedures.

//PRS PROC MN=EDIT,P1=XX.P2=,123 //S1 EXEC PGM=P1,PARM=(&P1&P2) //DD1 DD DSN=&DS..IN,DISP=&DSP //DD2 DD DSN=&DS..PDS(&MN),DISP=SHR //PEND end of procedure PRS Invoking procedure with Symbolic Parameters //SX EXEC PRS,DS=TRGIT,DSP=,MN=M

We can nullify a parameter value by not assigning any value to the symbolic parameter.(as shown in the slide for DSP parameter) In this example,P1 and P2 stands for positional parameter values in PARM parameter.Comma is included in the value for symbolic parameter P2, so that even if the symbolic parameter P1 is nullified , there will not be any problem .

Modifying EXEC parameters


//MP PROC //S1 EXEC PGM=P1,REGION=2K,TIME=2,ACCT=TR1 //DD1 DD DSN=TRG1T.IN,DISP=SHR //DD2 DD SYSOUT=* //S2 EXEC PGM=P2,REGION=1K,TIME=2,ACCT=TR2 //DD2 DD SYSOUT=* //PEND //JS1 EXEC MP ,ACCT=PR1,REGION=, // ADDRSPC=REAL,PARM=121299,S2.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.

Rules and Order


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

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

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. We code the overriding statements after the EXEC statement of proc calling in the JOB.

//procstepname.ddname DD parameters

Parameters on the overriding statement that are not coded on the procedure statement are added to the procedure statement. An entire overriding parameter must be coded,even though only part of the overridden parameter is being changed.

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.

Nested Procedures

Catalogued and in-stream procedures can invoke other procedures (up to 15 levels of nesting).

In a procedure , an EXEC statement may invoke another procedure ,which contains an EXEC statement to invoke another procedure. An in-stream procedure can not be defined within another procedure. If recursion occurs in nested procedures then expansion of JOB stream fails as expansion of nesting and JCL errors occurs.The submission will end with JCL error.

END OF THE SESSION

You might also like