0% found this document useful (0 votes)
41 views37 pages

JCL Training

The document provides an overview of Job Control Language (JCL), detailing its purpose in batch processing on z/OS and the role of Job Entry Subsystems (JES). It explains the basic JCL statements (JOB, EXEC, and DD), their syntax, and the parameters associated with them, along with examples. Additionally, it covers the use of conditional execution and return codes to control job step execution.

Uploaded by

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

JCL Training

The document provides an overview of Job Control Language (JCL), detailing its purpose in batch processing on z/OS and the role of Job Entry Subsystems (JES). It explains the basic JCL statements (JOB, EXEC, and DD), their syntax, and the parameters associated with them, along with examples. Additionally, it covers the use of conditional execution and return codes to control job step execution.

Uploaded by

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

JCL Training

Job Control Language (JCL)


 Job Control Language (JCL) tells the system what
program to execute and defines its inputs and outputs
 The basic elements of batch processing are shown in the
figure
 z/OS uses a Job Entry Subsystem (JES) to receive jobs
into the operating system to schedule them for
processing by z/OS and to control their output
processing
 JES is a collection of programs that handles the batch
workload on z/OS
 IBM provides two kinds of job entry subsystems – JES2
and JES3. They read jobs into the system, convert them
to internal machine-readable form, select them for
processing, process their output and purge them from
the system.
JCL Statements

 There are three basic JCL statements – JOB, EXEC and DD


 The figure to the right represents basic JCL coding syntax

Statement Description
JOB Provides the job name to the system for the batch workload.
It can optionally include accounting information and a few
job-wide parameters.
EXEC Provides the name of the program to execute. There can be
multiple EXEC statements in a job. Each EXEC statement
within the same job is called a job step.
DD DD stands for Data Definition. It provides inputs and outputs
to the execution program on the EXEC statement. This
statement links a data set or I/O device to a ddname coded in
the program. DD statements are associated with a particular
job step.
JCL - Example
//SRTEMP JOB (00967),’THOMAS’
//STEP10 EXEC PGM=SORT
//SORTIN DD DISP=SHR,DSN=SN32967.EMP.DETAILS
//SORTOUT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(1,15,CH,A)
/*

Statement Description
SRTEMP Job name
STEP10 Step name
SORTIN The ddname of the input file in the SORT program
SORTOUT The ddname of the output file in the SORT program
SYSOUT Output messages sent to the JES print output area
SYSIN Another input statement that tells SORT program on which fields to sort the data
JCL – Parameter Types

Parameter Type Description


Positional Parameters • Appears at a pre-defined position
• The order of the positional parameters matters
• Example: An accounting parameter in the JOB statement
• Example: PGM parameter in the EXEC statement
Keyword Parameters • Appears after the positional parameters
• They can appear in any order
• They can be omitted if not required
• The general syntax of a keyword parameter is KEYWORD=value
• Example: NOTIFY=&SYSUID
• Example: MSGCLASS=X
JOB Statement

 JOB statement identifies the job and the user who submits it
 The syntax of a JOB statement looks like
//Jobname JOB positional-parms,Keyword-parms
 Jobname identifies the job while submitting it to z/OS. It can be of length 1 to 8 with alphanumeric
characters and starts just after //.
 JOB is the keyword that identifies the JOB statement

Positional Parameters Description


Accounting Information Refers to whom the processor time is billed. It is mandatory.
Programmer Name Identifies the person or the group who is in charge of the JCL. It is
optional and can be replaced by a comma.
JOB Statement
Keyword Parameters Description

CLASS • Based on the number of resources required by the job, companies assign different job classes
• The job classes can be classified with respect to the environment (test, pre-prod, prod)
• Valid values for CLASS parameter are A to Z and 0 to 9
• CLASS=0 to 9|A to Z
• Ex: CLASS=A
MSGCLASS • Specifies the output destination for the system and the job messages when the job is complete
• MSGCLASS=CLASS
• Valid values of class can be A to Z or 0 to 9
• Ex: MSGCLASS=X indicates the job output is directed to the SPOOL
MSGLEVEL • Specifies the type of messages to be written to the output destination specified in the MSGCLASS
• MSGLEVEL=(Statements,Messages)
• Statements=Type of statements written to the output log
• 0 means job statements only
• 1 means JCL statements along with symbolic parameters expanded
• 2 means input JCL only
• Messages=Type of messages written to the output log
• 0 means allocation and termination messages written upon abnormal job completion
• 1 means allocation and termination messages written irrespective of the nature of job completion
• Ex: MSGLEVEL=(1,1)
JOB Statement
Keyword Parameters Description
TIME • Specifies the time span to be used by the processor to execute the job
• TIME=(mm,ss) or TIME=ss (mm is minutes and ss is seconds)
• Ex: TIME=30
• TIME=1440 or TIME=NOLIMIT means there is no time limit for this particular job
• TIME=MAXIMUM allows a job to use the maximum amount of CPU time
REGION • Specifies the address space required to run a job step within the job
• REGION=nK|nM (K is kilobyte and M is Megabyte)
• When REGION=0K or 0M, largest address space is provided for execution
TYPRUN • Specifies a special processing for the job
• TYPRUN=SCAN|HOLD
• SCAN checks for the syntax errors of the JCL without executing the job
• HOLD puts the job on hold in the job queue. To release the job, type “A” against the job in the SPOOL
that brings the job to execution.
NOTIFY • Sends the success or failure message to the user specified in this parameter
• NOTIFY=userID|&SYSUID
• userID is a specific user ID
• &SYSUID is the user ID submitting the JCL
PRTY • Specifies the priority of the job within a class
• If omitted, the job is added to the end of the queue in the specified class
• PRTY=N
• N varies from 0 to 15. The higher the value, the higher is the priority
JOB Statement – Examples

//SN45321A JOB (00052321),'TESJOB',CLASS=T,MSGCLASS=X


// MSGLEVEL=(1,1),TIME=(2,0),REGION=1M
// NOTIFY=&SYSUID

//STATREPT JOB (*),’KELLY',CLASS=T,MSGCLASS=X


// MSGCLASS=X,MSGLEVEL=(1,1),NOTIFY=&SYSUID,
// TYPERUN=SCAN

//TESTJOB1 JOB (*),,CLASS=A,MSGCLASS=X


// MSGCLASS=X,MSGLEVEL=(1,1),PRTY=5,
// NOTIFY=SN45321
EXEC Statement

 EXEC statement provides the program or the procedure to be executed in the job step
 The syntax of a EXEC statement looks like
//Stepname EXEC positional-parms,Keyword-parms
 Stepname identifies the job step within the JCL. It can be of length 1 to 8 with alphanumeric characters and
starts just after //.
 EXEC is the keyword that identifies the EXEC statement

Positional Parameters Description


PGM The program name to be executed in the job step
PROC The procedure name to be executed in the job step
EXEC Statement
Keyword Parameters Description
PARM • Provides the parameters to be passed to the program
• Ex: PARM=‘TEST’
• If the program is written in COBOL, the value passed through the PARM parameter in a JCL is received in the
LINKAGE SECTION of the program
REGION • REGION coded on an EXEC statement will apply to that job step only
• REGION coded on the JOB statement overrides the REGION coded in the EXEC statement of any job step
• Ex: REGION=40K
TIME • When coded on the EXEC statement, it applies to that job step only
• If TIME is specified on both JOB and EXEC statements then both will be in effect and can cause time out
errors due to either of them. Hence not recommended to use in both JOB and EXEC statement together.
EXEC Statement – Examples
//JOBA JOB ,’TEST1’,TIME=4
//S10 EXEC PGM=PROGRAMX,TIME=2
//S20 EXEC PGM=PROGRAMY,TIME=2

The job is allowed 4 minutes of execution time and each step is allowed 2 minutes. If either step tries to execute beyond 2 minutes, the
job will terminate beginning with that step.

//JOBB JOB ,,TIME=3


//S10 EXEC PGM=PROGRAMA,TIME=2
//S20 EXEC PGM=PROGRAMB,TIME=2

The job is allowed 3 minutes of execution time. Each step is allowed 2 minutes of execution time. Should either step try to execute
beyond 2 minutes, the job will terminate beginning with that step. If step S10 executes in 1.6 minutes, then step S20 tries to execute
beyond 1.4 minutes, then the job will be terminated because of the 3 minutes time limit specified on the JOB statement.
//JOBC JOB ,’TEST10’,TIME=2
//S10 EXEC PGM=PROGRAMP,TIME=3

The job is allowed 2 minutes of execution time. Since the time specified on the JOB statement is less than the time on the EXEC
statement, the step S10 is only allowed 2 minutes of execution time. If step S10 attempts to execute beyond 2 minutes, the job will
terminate in that step.

//JOBD JOB ,,TIME=1440


//S10 EXEC PGM=PROGRAMZ,TIME=20

Since TIME=1440 is specified on the JOB statement, any TIME values on an EXEC statement will be nullified.
EXEC Statement
Keyword Parameters Description
COND • Used to control the job step execution based on the Return Code (RC) of the previous step
• The COND parameter can be coded on JOB statement or EXEC statement.
• If the COND parameter is coded on the JOB statement and on one or more of the job’s EXEC statements and
if a RC test on the JOB statement is satisfied, then the job terminates. In this case the system ignores any
EXEC statement COND parameter. If the RC tests on the JOB statement are not satisfied, the system then
performs the RC tests on the EXEC statement. If an EXEC RC test is satisfied, the step is bypassed.
• COND=(code,logical-operator) or COND=(code,logical-operator,stepname) or COND=EVEN or COND=ONLY
• code specifies a number that the system compares to the return code from each job step
• logical-operator specifies the type of comparison (GT, GE, EQ, LT, LE, NE) to be made with the RC
• EVEN specifies that the job step is to be executed even if a preceding job step abnormally terminated
• ONLY specifies that the job step is to be executed only if a preceding job step abnormally terminated

Return Code (RC) Return Code (RC) Description


0 Success/Normal
 When a job completes, a Return Code (RC) is set based on
4 Warning (minor errors)
the status of execution
8 Error (significant errors)
 The Return Code (RC) is a number from 0 to 4095 12 Sever Error (major errors)

 The table on the right shows some common return codes 16 Fatal Error (very serious errors)
EXEC Statement – Examples

COND in the JOB statement

//CNDSAMP JOB CLASS=6,NOTIFY=&SYSUID,COND=(5,LE)


//*
//STEP10 EXEC PGM=FIRSTP
//* STEP10 executes without any test being performed.

//STEP20 EXEC PGM=SECONDP


//* STEP20 is bypassed, if RC of STEP10 is 5 or above.
//* Say STEP10 ends with RC4 and hence test is false.
//* So STEP20 executes and lets say it ends with RC16.

//STEP30 EXEC PGM=SORT


//* STEP30 is bypassed since 5 <= 16.
EXEC Statement – Examples

COND in the EXEC statement

//CNDSAMP JOB CLASS=6,NOTIFY=&SYSUID


//*
//STP01 EXEC PGM=SORT
//* Assuming STP01 ends with RC0.

//STP02 EXEC PGM=MYCOBB,COND=(0,EQ,STP01)


//* In STP02, condition evaluates to TRUE and step bypassed.

//STP03 EXEC PGM=IEBGENER,COND=((10,LT,STP01),(10,GT,STP02))


//* In STP03, first condition fails and hence STP03 executes.
//* Since STP02 is bypassed, the condition (10,GT,STP02) in
//* STP03 is not tested.
EXEC Statement – Examples

COND is coded as EVEN

//CNDSAMP JOB CLASS=6,NOTIFY=&SYSUID


//*
//STP01 EXEC PGM=SORT
//* Assuming STP01 ends with RC0.

//STP02 EXEC PGM=MYCOBB,COND=(0,EQ,STP01)


//* In STP02, condition evaluates to TRUE and step bypassed.

//STP03 EXEC PGM=IEBGENER,COND=((10,LT,STP01),EVEN)


//* In STP03, condition (10,LT,STP01) evaluates to false,
//* STP02 is not executed and bypassed, hence the step is bypassed.
EXEC Statement – Examples

COND is coded as ONLY

//CNDSAMP JOB CLASS=6,NOTIFY=&SYSUID


//*
//STP01 EXEC PGM=SORT
//* Assuming STP01 ends with RC0.

//STP02 EXEC PGM=MYCOBB,COND=(4,EQ,STP01)


//* In STP02, condition evaluates to FALSE, step is executed
//* and assume the step abends.

//STP03 EXEC PGM=IEBGENER,COND=((0,EQ,STP01),ONLY)


//* In STP03, though the STP02 abends, the condition
//* (0,EQ,STP01) is met. Hence STP03 is bypassed.
EXEC Statement – Examples
//TYPE JOB (611,402),BOURNE,COND=(7,LT)

The COND parameter specifies that if 7 is less than the return code, the system terminates the job. Any return code less than or equal to 7
allows the job to continue.

//TEST JOB 501,BAXTER,COND=((20,GE),(30,LT))

The COND parameter specifies that if 20 is greater than or equal to the return code or if 30 is less than the return code, the system
terminates the job. Any code of 21 through 30 allows the job to continue.

//STEP6 EXEC PGM=DISKUTIL,COND=(4,GT,STEP3)

If the return code from STEP3 is 0 through 3, the system bypasses STEP6. If the return code is 4 or greater, the system executes STEP6.
EXEC Statement – Examples
//TEST2 EXEC PGM=DUMPINT,COND=((16,GE),(90,LE,STEP1),ONLY))

The system executes this step ONLY if two conditions are met:
• A preceding job step abnormally terminated
• No return code tests are satisfied

Therefore, the system executes this step only when all three of the following are true:
• A preceding job step abnormally terminated
• The return codes from all preceding steps are 17 or greater
• The return code from STEP1 is 89 or less

The system bypasses this step if any one of the following is true:
• All preceding job steps terminated normally
• The return code from any preceding step is 0 through 16
• The return code from STEP1 is 90 or greater
DD Statement

 DD statement provides the definition of each data set used in JCL


 The syntax of a DD statement looks like
//DDname DD parameters
 DDname identifies the data set or input/output resource. If this is an input or output file used by a COBOL
program, then the file is referenced by this name within the program.
 DD is the keyword that identifies the DD statement

Parameters Description
DSN/DSNAME • The name of the data set
• It can include creation of a temporary data set or new data sets
or a reference back to the data set name
• DSN=dsname or DSN=&&tempds or DSN=*.stepname.ddname
• Ex: DSN=SN45321.ORDER.DETAILS
• Ex: DSN=&&TEMP
• Ex: DSN=*.S10.ORDFILE
DD Statement – DDNAME and DSNAME

 As shown in the above figure to the right, there is a


program in some language that needs to open and read a
data set
 When the program is coded, the name XYZ is arbitrarily
selected to reference the data set. The program can be
compiled and stored as an executable.
 When someone wants to run the program, a JCL statement
must be supplied that relates the name XYZ to an actual
data set name. The JCL statement is a DD statement. The
logical name (DDNAME) used in the program is a DD name
and the real name of the data set is a DSNAME (or DSN).
 The program can be used to process different input data
sets simply by changing the DSNAME or DSN in JCL as
shown in the below figure to the right
DD Statement
Parameters Description
DISP • Data set disposition which states whether the dataset is to be created or it already exists and if it can be
shared by more than one job
• DISP=(status,normal-disp,abnormal-disp)
• status can be NEW, OLD, SHR or MOD. NEW is the default value.
 NEW – The data set is newly created by the job step
 OLD – The data set is already created and will be overwritten in the job step. The job gains exclusive
access on the data set and no other job can access this data set until the completion of the job step.
 SHR – The data set is already created and will be read in the job step. The data set can be shared by
other jobs at the same time.
 MOD – The data set is already created and new records can be added to the end of the data set
(existing records will not be overwritten)
• normal-disp parameter can be CATLG, UNCATLG, DELETE, PASS or KEEP. If status is NEW, default normal-
disposition is DELETE, else it is KEEP.
• abnormal-disp parameter can be CATLG, UNCATLG, DELETE and KEEP. If status is NEW, default abnormal-
disposition is DELETE, else it is KEEP.
 CATLG – Keep and catalog the data set at the end of the job step
 UNCATLG – Keep the data set but uncatalog it at the end of the job step
 DELETE – Delete the data set at the end of the job step
 KEEP – Keep the data set at the end of the job step
 PASS – Allow a later job step to specify a final disposition. It is valid only for normal-disp parameter.
DD Statement
Parameters Description
DCB • DCB stands for Data Control Block. It details the physical characteristics of a data set.
• This parameter is required for data sets that are newly created in the job step
• Common parameters include
 DSORG – The data set organization, which can be sequential or partitioned
 LRECL – The logical record length, which is the number of bytes/characters in each record
 RECFM – The record format, which can be fixed or variable
 BLKSIZE – The size of the physical block that stores records. Typically it is a multiple of LRECL. A value
of 0 will let the system pick the best value.
• When there is a need to replicate the DCB values of one data set to another within the same jobstep or
JCL, then it is specified as DCB=*.stepname.ddname where stepname is the name of the job step and
ddname is the data set from which the DCB is to be copied.
SPACE • The amount of disk storage requested for the new data set
• SPACE=(unit,(primary,secondary,dir),RLSE)
• unit is either CYL (cylinder), TRK (track), BLKSIZE (blocksize)
• primary is the primary space required for the data set
• secondary is the additional space required when the primary space is not sufficient
• dir is the directory blocks if the data set is a PDS
• RLSE is used to release the unused space at job completion
DD Statement
Parameters Description
UNIT • Specifies the type of the device on which the data set is to be stored
• UNIT=DASD|SYSDA
• DASD stands for Direct Access Storage Device and SYSDA stands for System Direct Access and refers to the
next available disk storage device
• Ex: UNIT=3390 or UNIT=SYSDA
VOL • Specifies the volume serial number on the device identified by the UNIT parameter
• VOL=SER=xxxxxx, where xxxxxx is the volume serial
• VOL=REF=*.DDNAME, where REF is the backward reference to the volume serial number of a data set in
any of the preceding job steps in the JCL
SYSOUT • Directs the data to the output device based on the class specified
• SYSOUT=class
• If class is * then it directs the output to the same destination as that of the MSGCLASS parameter in the
JOB statement
DUMMY • Results in a null input or throwing away data written to this ddname
* • Input data or control statements follow. This is a method of passing data to a program from the JCL stream
*,DLM= • DLM parameter is used to specify a delimiter to terminate the in-stream data
• When DLM parameter assigns a different delimiter, the in-stream data records can include standard
delimiters such as /* and // in the data
DD Statement – Examples
//TTYYSAMP JOB ,'TUTO',CLASS=6,MSGCLASS=X,REGION=8K,
// NOTIFY=&SYSUID
//*
//STEP010 EXEC PGM=ICETOOL,ADDRSPC=REAL
//*
//INPUT1 DD DSN=TUTO.SORT.INPUT1,DISP=SHR
//INPUT2 DD DSN=TUTO.SORT.INPUT2,DISP=SHR,UNIT=SYSDA,
// VOL=SER=(1243,1244)
//OUTPUT1 DD DSN=MYFILES.SAMPLE.OUTPUT1,DISP=(,CATLG,DELETE),
// DCB=(RECFM=FB,LRECL=80),SPACE=(CYL,(10,20))
//OUTPUT2 DD SYSOUT=*

//DD1 DD *,DLM=AA
.
.
data
.
AA

The DLM parameter assigns the characters AA as the delimiter for the data defined in the input stream by DD statement DD1.
DD Statement – Examples
//DD1 DD DSNAME=ALP,DISP=(,KEEP),VOLUME=SER=44321,
// UNIT=3400-6,DCB=(RECFM=FB,LRECL=240,BLKSIZE=960)

//DD1A DD DSNAME=EVER,DISP=(NEW,KEEP),UNIT=3380,
// DCB=(RECFM=FB,LRECL=326,BLKSIZE=23472),
// SPACE=(23472,(200,40))

//DD1B DD DSNAME=EVER,DISP=(NEW,KEEP),UNIT=3380,
// DCB=(RECFM=FB,LRECL=326),
// SPACE=(23472,(200,40))

DD statement DD1B is the same as the DD1A statement except that it shows the alternate syntax for the DCB keyword subparameters. Also,
because BLKSIZE is omitted, the system will select an optimum block size for the data.

//DD2 DD DSNAME=BAL,DISP=OLD,DCB=(RECFM=F,LRECL=80,
// BLKSIZE=80)
//DD3 DD DSNAME=CNANN,DISP=(,CATLG,DELETE),UNIT=3400-6,
// VOLUME=SER=663488,DCB=*.DD2

DD statement DD3 defines a new data set named CNANN and requests that the system copy the DCB subparameters from DD statement
DD2, which is in the same job step.
Reserved DD names

 A programmer can select almost any name for a DD name, but using a meaningful name (within the eight character
limit) is recommended
 There are few reserved DD names that a programmer cannot use (all of these are optional DD statements)

Reserved DD Name Description


//JOBLIB DD … • Placed just after the JOB statement that specifies a library that should be searched first
for the programs executed by this job
//STEPLIB DD … • Placed just after an EXEC statement that specifies a library that should be searched first
for the program executed by the EXEC statement
• A STEPLIB overrides the JOBLIB if both are used
//JOBCAT DD … • JOBCAT and STEPCAT are used to specify private catalogs, but these are rarely used
//STEPCAT DD …
//SYSABEND DD … • SYSABEND, SYSUDUMP, SYSMDUMP and CEEDUMP DD statements are used for various
//SYSUDUMP DD … types of memory dumps that are generated when a program abnormally ends
//SYSMDUMP DD …
//CEEDUMP DD …
SDSF

 SDSF stands for System Display and Search Facility


 SDSF provides with information to monitor, manage
and control z/OS system
 There are many activities that you can perform
including:
 Cancel, hold or release jobs
 Find out if jobs are waiting to be processed
 Filter the jobs to show just the jobs that interest
you
 View output before it is printed
 Change a job’s priority, class or destination
 Edit and resubmit the JCL without leaving SDSF
 You can invoke SDSF from the ISPF Primary Option
Menu by entering S or option 13.14
Data set Concatenation

 A single ddname can have multiple DD statements. This is called data set concatenation.
 Concatenation applies only to input data sets.
 The data sets are automatically processed in sequence.

//DATAIN DD DISP=OLD,DSN=SN244521.INPUT1
// DD DISP=OLD,DSN=SN244521.INPUT2
// DD DISP=SHR,DSN=SN456987.DATA

In the above example, when the application program reads to the end of MY.INPUT1, the system automatically
opens MY.INPUT2 and starts reading it. The application program is not aware that it is now reading a second
data set. This continues until the last data in the concatenation is read; at that point, the application receives an
end-of-file indication.
JCL Procedures

 JCL procedure is a set of JCL statements grouped together to perform a particular function
 Fixed part of the JCL is coded in the procedure and the varying part is coded within the JCL
 Syntax:
//procname PROC
//…
//…
// PEND
 PROC and PEND statements are unique to procedures and they identify the beginning and the end of a JCL procedure
 PROC is preceded by the procedure name
 Based on how the procedure is held with respect to the JCL, the procedures are classified into
 Instream Procedures
 Cataloged Procedures
JCL Procedures – Instream Procedures
 When the procedure is coded within the same JCL member, it is called as an Instream Procedure
 It should start with a PROC statement and end with a PEND statement
//SAMPINST JOB ,,CLASS=A,MSGCLASS=X,NOTIFY=&SYSUID
//*
//INSTPROC PROC //*START OF PROCEDURE
//PROCST EXEC PGM=SORT
//SORTIN DD DSN=&DSNM,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD DSN=&DATAC,DISP=SHR
// PEND //*END OF PROCEDURE
//*
//STEP10 EXEC INSTPROC,DSNM=SN52241.SAMPLE.INPUT1,
// DATAC=SN452241.DATA.LIB(DSETA)
//*
//STEP20 EXEC INSTPROC,DSNM=SN52241.SAMPLE.INPUT2
// DATAC=SN452241.DATA.LIB(DSETB)
//*

Procedure INSTPROC is called in STEP10 and STEP20 using different input files. The parameters DSNM and DATAC can be
coded with different values while calling the procedure.

 A symbolic parameter is a variable within a procedure to which a value may be assigned by coding on the EXEC statement
the name of the symbolic parameter and its desired value
JCL Procedures – Cataloged Procedures
 When the procedure is separated out from the JCL and coded in a different member, it is called a Cataloged Procedure

//SAMPINST JOB ,,CLASS=A,MSGCLASS=X,NOTIFY=&SYSUID


//*
//STEP EXEC CATLPROC,PROG=CATPRCA,DSNM1=SN52241.INPUT.DATA
// SYSINDAT=SN452241.DATA.LIB(MEMB1)

PROG, SYSINDAT and DSNM are passed as symbolic parameters to the procedure CATLPROC.

//CATLPROC PROC PROG=,CORELIB=SN52241.CORE.LIB


//*
//PROC1 EXEC PGM=&PROG
//STEPLIB DD DSN=&CORELIB,DISP=SHR
//IN1 DD DSN=&DSNM1,DISP=SHR
//OUT1 DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD DSN=&SYSINDAT
//*

Within the procedure, the symbolic parameters PROG and CORELIB are coded. Please note that the PROG parameter within the
procedure is overridden by the value in the JCL and hence PGM takes the value CATPRCA during execution.
JCL Procedures – Nested Procedures
 Calling a procedure from within a procedure is called a nested procedure. Procedures can be nested up to 15 levels.
 The nesting can be completely in-stream or cataloged. Cannot code an instream procedure within a cataloged procedure.

Procedure C: Job Stream:


//C PROC //JOB1 JOB
//CS1 EXEC PGM=GHI //STEP1 EXEC PROC=A
. .
// PEND //STEP2 EXEC PGM=JKL
.
Procedure B: .
//B PROC
//BS1 EXEC PROC=C
.
//BS2 EXEC PGM=DEF
.
// PEND

Procedure A:
//A PROC
//AS1 EXEC PROC=B
.
//AS2 EXEC PGM=ABC
.
// PEND
.
System Libraries

 z/OS has many standard system libraries


 These libraries are in standard PDS format and are found on the system disk volumes

Library Description
SYS1.PROCLIB • Contains JCL procedures distributed with z/OS
• In practice, there may be many other JCL procedure libraries concatenated with it
SYS1.PARMLIB • Contains control parameters for z/OS and for some program products
• In practice, there may be other libraries concatenated with it
SYS1.LINKLIB • Contains many of the basic execution modules of the system
• In practice it is one of a large number of execution libraries that are concatenated
SYS1.NUCLEUS • Contains the basic supervisor (“kernel”) modules of z/OS
SYS1.SVCLIB • Contains operating system routines known as supervisor calls (SVCs)
Utilities

 z/OS includes a number of small programs called utilities, which are useful in batch processing.
 These programs provide many small useful functions.

Utility Description
IEFBR14 • The only function of this program is to provide a zero (0) return code by doing nothing
• Usually used to create an empty data set or delete an existing data set
IEBGENER • Copies one sequential data set to another
• A member of a partitioned data set can also be used as a sequential data set
IEBCOPY • Copy, merge, compress, back-up or restore PDS
IDCAMS • Primarily used to create and manipulate VSAM data sets
DFSORT

 IBM utility used to copy, sort or merge data sets


 SORTIN and SORTINnn DD statements are used to specify input data sets
 SORTOUT and OUTFIL statements are used to specify output data sets
 SYSIN DD statement is used to specify the sort and merge conditions.
 DFSORT is generally used to achieve the following functionalities:
 SORT the input files in the order of the specified field(s) position in the file
 INCLUDE or OMIT records from the input file(s) based on the specified condition
 SORT MERGE input file(s) in the order of the specified field(s) position in the file
 SORT JOIN two or more input files based on a specified JOIN key (field(s) in each input file)

References
https://www.mainframestechhelp.com/utilities/sort/

http://www.mainframegurukul.com/srcsinc/drona/programming/languages/jcl/jcl.sort.html
Hands On

 Practice the hands on as listed in the below reference sites


https://www.mainframestechhelp.com/utilities/sort/
http://www.mainframegurukul.com/srcsinc/drona/programming/languages/jcl/jcl.sort.html

You might also like