158
1 Course Title : Introduction to JCL Presented By : Sudheer & Thiru

JCL Presentation

Embed Size (px)

Citation preview

Page 1: JCL Presentation

1

Course Title : Introduction to JCL

Presented By : Sudheer & Thiru

Page 2: JCL Presentation

Introduction to JCL

25

2

Click to edit Master title style

Pre-Requisite None

Target

Audience

Those who work on mainframes

Mode of

Training

Class Room Session

Evaluation

Criteria

Course Details

Page 3: JCL Presentation

Introduction to JCL

25

3

Click to edit Master title style

Module No. Topic

1. Introduction to JCL

2. JCL Statements

3. JOB Statements

4. EXEC Statements

5. DD Statements

6. Procedures

7. Utility Programs

Lesson Plan

Page 4: JCL Presentation

Introduction to JCL

25

4

Click to edit Master title style

Introduction to JCL

Page 5: JCL Presentation

Introduction to JCL

25

5

Click to edit Master title styleHistorical Background

In the early period of computer usage the systems were largely batch- oriented and the input to the system was through punched cards . These cards had 80 columns in which statements could be punched and had to be read through a complex procedure. Although these are no longer in use and terminals are used for inputting, the basic 80 column format remains unchanged .   The most common cards are JOB, EXEC and DD.    The set of cards that are required to execute a job is called a batch and hence the term Batch Processing.

Page 6: JCL Presentation

Introduction to JCL

25

6

Click to edit Master title style

// DD

// EXEC

// JOB

Historical Background

Page 7: JCL Presentation

Introduction to JCL

25

7

Click to edit Master title style

  It is a language using which the user interfaces with the operating system and describes the program steps to be run.  Defines the files (datasets) from which inputs have to be taken and results written on to.   Indicates accounting information (Who is the user, How much resources he is using etc.,)  Defines the resource limits the user has to operate within (No. of CPU secs, size of memory allocation etc.)  Directs the print output to the defined printer. 

What is JCL?

Page 8: JCL Presentation

Introduction to JCL

25

8

Click to edit Master title style

USER 1

USER 3

OPERATINGSYSTEM

USER 2 JCL

JCL

JCL

What is JCL?

Page 9: JCL Presentation

Introduction to JCL

25

9

Click to edit Master title style

A Job is the execution of one or more related programs in sequence.    Each program to be executed by a job is called a job step.

Job Step

Page 10: JCL Presentation

Introduction to JCL

25

10

Click to edit Master title style

// TEXT #2 JOB(2237,4), ‘PHASE 1’,CLASS=A

//STEP1 EXEC PGM=CALCExecute CALC

Program

//STEP2 EXEC PGM=SORT Execute SORT Program

//STEP1 EXEC PGM=STATSExecute STATS

Program

Job Step

Page 11: JCL Presentation

Introduction to JCL

25

11

Click to edit Master title style

Every installation has a supervisor program which interprets the incoming JCL statements. This program is called Job Entry Subsystem

(JES). There are two versions of this subsystem. They are JES2 and

JES3. These could be a Supervisor Program or a Scheduler.

JES3 has a structure //* command parameter.

JES2 has format /* command.

JES is responsible for managing jobs in an MVS System (Job Management). In order to support a user workload, MVS requires assistance. That assistance comes in the form of a subsystem namely JES.

MVS shares its workload with JES which manages the work or job before and after execution.

Execution of JCL code

Page 12: JCL Presentation

Introduction to JCL

25

12

Click to edit Master title style

Job Control Statements Job Control Statements

Page 13: JCL Presentation

Introduction to JCL

25

13

Click to edit Master title style

JCL statements are to be written in 80-column format.  Columns 1 to 3 contain the Identifier field.  Columns 4 (3) to 12 contain the Name field.  Column 12 onwards is the Operation field indicating the type of control statement. Not applicable to NULL,COMMENT and DELIMITER statements. Must be preceded and followed by at least one blank space.   The Parameter field starts after the Operation field with a blank space preceding it. It cannot have blank spaces in between and can continue up to Column 71.  The Comment field starts after the parameter field preceded by a space and extends up to Column 80.

Job Control Statements

Page 14: JCL Presentation

Introduction to JCL

25

14

Click to edit Master title style

IDENTIFIER FIELD

NAME FIELD

OPERATION FIELD

PARAMETER FIELD

COMMENT FIELD

Job Control Statements

Page 15: JCL Presentation

Introduction to JCL

25

15

Click to edit Master title style

The Identifier field indicates the type of statement to the system.   // in the first 2 columns indicates that the statement is a JCL statement.   / * in the first 2 columns indicates that it is a delimiter of the preceding statements.   / / * in the first 3 columns indicates that it is a comment statement which has to be ignored by the system.

Identifier Field

Page 16: JCL Presentation

Introduction to JCL

25

16

Click to edit Master title style

//

/

*//*

Column 1

Identifier Field

Page 17: JCL Presentation

Introduction to JCL

25

17

Click to edit Master title style

The Name field should follow the identifier.   It should begin in Column 3.   It can have a maximum of 8 characters.   Valid characters are A - Z, 0 - 9 and national characters (# $ @)).   It should start either with an alphabet or a national character.

Identifier Field

Page 18: JCL Presentation

Introduction to JCL

25

18

Click to edit Master title style

//CGI001A

//#1STEP

//AB004

Name Field

Page 19: JCL Presentation

Introduction to JCL

25

19

Click to edit Master title style

Operation field should be preceded and followed by at least one blank space.   It follows the Name field.   This indicates the type of statement and its purpose.  It is preferable to start this field from Column 12.

Operation Field

Page 20: JCL Presentation

Introduction to JCL

25

20

Click to edit Master title style

JOB

EXEC

DD

IF

JCLLIB

Operation Field

Page 21: JCL Presentation

Introduction to JCL

25

21

Click to edit Master title style

Parameter field should follow the Operation field.   It should be preceded and followed by a blank space.   The list of parameters are separated by commas.   No blank spaces in between parameter lists.   Preferably started from Column 17 and can be extended up to column 71.

Parameter Field

Page 22: JCL Presentation

Introduction to JCL

25

22

Click to edit Master title style

(1024,14),’JONES’,CLASS=A

PGM=IEFBR14

DSN=&&TEMP,DISP=OLD

Parameter Field

Page 23: JCL Presentation

Introduction to JCL

25

23

Click to edit Master title style

Positional parameters must appear first in the parameter list.   Should appear in the correct order.   Missing parameters must be indicated by a comma. 

If the missing positional parameter is the last parameter, or if all following positional parameters are also absent, subsequent replacing commas need not be coded.   

The enclosing parentheses can be omitted if a sub parameter consists of a single value.    Nothing needs to be coded if all positional parameters are absent.

Positional Parameters

Page 24: JCL Presentation

Introduction to JCL

25

24

Click to edit Master title style

//IMR04A JOB (234792,78),’JONES’,MSGCLASS=A

// IMR069 JOB ,’VICTOR’,CLASS=H

//SYSIN DD DATA

//ABC008X JOB (45992,100,40),NOTIFY=IMR004

Positional Parameters

Page 25: JCL Presentation

Introduction to JCL

25

25

Click to edit Master title style

Keyword parameters may be coded in any order in the operand field.   It should follow the positional parameters after a comma.    Absence of this parameter need not be indicated.

Keyword Parameters

Page 26: JCL Presentation

Introduction to JCL

25

26

Click to edit Master title style

//INFILE DD DSN=CPVJPO.JCL.J1,DISP=OLD

//OUT1 DD DSN=&&TEMP,DISP=OLD

//COB2 EXEC PGM=IGYCRCTL,REGION=1024K

Keyword Parameters

Page 27: JCL Presentation

Introduction to JCL

25

27

Click to edit Master title style

Comment filed can be coded if there is at least 1 operand field.   It should follow the Parameter list.   It should be preceded by at least one blank space.   It can be extended up to Column 80.    Note : Comment field is different from the Comment line.

Comment Field

Page 28: JCL Presentation

Introduction to JCL

25

28

Click to edit Master title style

//Name Operator Operand Comment

//ST1 EXEC PGM=ADDPGM This is step 1

//IN1 DD DSN =CPV.COB ,DISP=(,CATL) This is the input

Comment Field

Page 29: JCL Presentation

Introduction to JCL

25

29

Click to edit Master title style

Any JCL statement can be extended up to Column 71. If we wish to continue this statement, we normally interrupt this statement after a complete parameter field.   The next line will have // in the first 2 columns and then the previous statement can be continued anywhere between Columns 4 and 16.

It is a good practice to start the continuation line at column 12.

Continuation of JCL StatementsContinuation of JCL statements

Page 30: JCL Presentation

Introduction to JCL

25

30

Click to edit Master title style

Col 1 Col 12//OUT1 DD DSN=CG1004A.JCL.J5,DISP=NEW,// SPACE=(TRK(1,1)),// UNIT=SYSDA

//CG1005X JOB(45992),’SMITH’,CLASS=A,MSGLEVEL=1,// REGION=1040K

Continuation of JCL statements

Page 31: JCL Presentation

Introduction to JCL

25

31

Click to edit Master title style

If you wish to continue the comment field after Column 80 :   First interrupt the comment field at or well before Column 71.   Have a non-blank character in Column 72.   Code // in the first 2 columns of the next line.   Continue the comment field anywhere after Column 3.

Continuation of Comment field

Page 32: JCL Presentation

Introduction to JCL

25

32

Click to edit Master title style

Col1 Col 72

//TESTSP EXEC SORT5 This step will *

// execute a sort procedure

Continuation of comment field

Page 33: JCL Presentation

Introduction to JCL

25

33

Click to edit Master title styleComment line

/ / * in the first 3 columns indicates that it is a comment statement

  It can be extended up to Column 80.

Page 34: JCL Presentation

Introduction to JCL

25

34

Click to edit Master title style

//* This JCL will execute 2 steps

//* This step will sort an input file and

//* store the result in another file.

Comment line

Page 35: JCL Presentation

Introduction to JCL

25

35

Click to edit Master title style

Columns

1 2 3 4 12 71 72 73 80 / / JOBNAME JOB <Parameter Fields> Comment field

/ / JOB1 JOB A2312,’JOHNNY’ * This is my

/ / First JOB

Example of Job Control Statements

Page 36: JCL Presentation

Introduction to JCL

25

36

Click to edit Master title style

Job Statement

Page 37: JCL Presentation

Introduction to JCL

25

37

Click to edit Master title style

Each Job must begin with a single JOB statement.   Installations usually establish a fixed JOB statement format that must be used.

Job Statement

Page 38: JCL Presentation

Introduction to JCL

25

38

Click to edit Master title style

//JOBNAME JOB POSITIONAL PARAMETERS,KEYWORD PARAMETERS

//RT452216 JOB (45992.522), ‘SMITH’,CLASS=A

//JOBNAME JOB (ACCOUNTING INFORMATION),’NAME’,CLASS=LETTER

Often specified by installation

Always specified by installation

Often specified by installation

Job Statement

Page 39: JCL Presentation

Introduction to JCL

25

39

Click to edit Master title style

The JOBNAME identifies the job to the Operating system.

 

 

It can range from one to eight alphanumeric (A-Z, 0-9) or national

characters (@,#,$).

 

 The first character must begin in column 3 and be alphabetic (A-Z)

or national characters.

Job Name

Page 40: JCL Presentation

Introduction to JCL

25

40

Click to edit Master title style

CORRECT INCORRECT

//GDB406 //6J

//A8463 //SUPERCOMP

//B8750#12 //RUN#6

Job Statement

Page 41: JCL Presentation

Introduction to JCL

25

41

Click to edit Master title style

ACCOUNTING INFORMATION

 PROGRAMMER’S NAME

Positional Parameter in Job Statement

Page 42: JCL Presentation

Introduction to JCL

25

42

Click to edit Master title style

ACCOUNTING INFORMATION   This must be defined by an installation.   All sub-parameters must be separated by commas.   If it contains any special characters, it should be enclosed within apostrophes.

Positional Parameter in Job Statement

Page 43: JCL Presentation

Introduction to JCL

25

43

Click to edit Master title style

(acct-number,additional-acct-information)

//JOBNAME JOB 2011

//JOBNAME JOB (20746.30,’56 + 97/22’,6.94)

Accounting information

Page 44: JCL Presentation

Introduction to JCL

25

44

Click to edit Master title style

  One to twenty character name.   If it contains special characters, it must be enclosed within apostrophes.   A legitimate apostrophe is coded as two consecutive apostrophes.

Programmer’s Name

Page 45: JCL Presentation

Introduction to JCL

25

45

Click to edit Master title style

//JOBNAME JOB (4562,200), SMITH

//JOBNAME JOB ‘KING’

//JOBNAME JOB 6452,’O’’REILLY’

Programmer’s Name

Page 46: JCL Presentation

Introduction to JCL

25

46

Click to edit Master title style

Most of the keyword parameters have installation standard values which should be used when coded.   If standards are not followed, it is automatically replaced by the system.

KEY-WORD Parameters in Job Statement

Page 47: JCL Presentation

Introduction to JCL

25

47

Click to edit Master title style

CLASS NOTIFY

MSGCLASS ADDRSPC

MSGLEVEL COND

TYPRUN TIME

RESTART REGION

PRTY

KEY-WORD Parameters in Job Statement

Page 48: JCL Presentation

Introduction to JCL

25

48

Click to edit Master title style

The installation will specify which of the 36 possible job classes to use.   Job classes range from A-Z, 0-9.   Installation establishes a default job class that is in effect if CLASS is omitted.   JOB CLASS also determines the overall priority of a job along with the PRTY parameter.   Jobs within the same JOB CLASS are queued together in the input queue to await execution.

Class

Page 49: JCL Presentation

Introduction to JCL

25

49

Click to edit Master title style

CLASS = class

//JOBNAME JOB (4596,2781),CLASS=A

Class

Page 50: JCL Presentation

Introduction to JCL

25

50

Click to edit Master title style

It specifies Job Scheduler Output Class.   The Output Class is a single character, A to Z or 0 to 9.   The installation sets the default if omitted.   Job Scheduler messages include all messages not printed by the actual job steps being executed, that is, JCL statements and error messages, device allocations, data set dispositions and accounting information.

Msgclass

Page 51: JCL Presentation

Introduction to JCL

25

51

Click to edit Master title style

MSGCLASS=class

//FIRST JOB (3498,’2217060’),’AAA’,CLASS=A,MSGCLASS=A

Msgclass

Page 52: JCL Presentation

Introduction to JCL

25

52

Click to edit Master title style

The values for JCL and allocations are as follows :  JCL Meaning  0 Print only JOB statement 1 Print all JCL in the input stream and all the JCL in any

catalogued procedures invoked, including the internal representation of statements after symbolic parameter

substitutions. Also print all JES2 and JES3 statements.2 Print only the JCL in the input stream and any JES2 and

JES3 control statements.  AllocationsMeaning  0 Print only JCL messages but no allocation, JES or

operator messages unless the job terminates abnormally. 1 Print all allocation, JES and operator messages.

MsgclassMsglevel=(jcl,allocations)

Page 53: JCL Presentation

Introduction to JCL

25

53

Click to edit Master title style

//JOBNAME JOB CLASS=A,MSGCLASS=D,MSGLEVEL=(0,0)

//JOBNAME JOB MSGCLASS=H,MSGLEVEL=2

//JOBNAME JOB MSGLEVEL=( ,1)

Msglevel=(jcl,allocations)

Page 54: JCL Presentation

Introduction to JCL

25

54

Click to edit Master title style

TYPRUN=SCAN, checks the JCL for syntax errors and suppresses execution of the job.  TYPRUN=HOLD, holds a job in the input queue for later execution. The job is held until the operator releases it.

TYPRUN=JCLHOLD, also holds the job till the operator releases it, but differs from TYPRUN=HOLD, in that the JCL is not checked until the operator releases the job.  

TYPRUN Statement

Page 55: JCL Presentation

Introduction to JCL

25

55

Click to edit Master title style

TYPRUN=SCAN/HOLD

//FIRSTJOB ,’SMITH’,CLASS=M,TYPRUN=SCAN

TYPRUN Statement

Page 56: JCL Presentation

Introduction to JCL

25

56

Click to edit Master title style

MVS allows programs that abnormally terminate, or even those that run to completion, to be restarted so that the entire job does not need to be returned in the event of an error.   To do this, code a RESTART parameter on the JOB statement to name the step from which to restart and submit the job.

Restart

Page 57: JCL Presentation

Introduction to JCL

25

57

Click to edit Master title style

RESTART = stepname

//RT45367 JOB(45992),’SMITH’,CLASS=A,RESTART=STEP6 //RT452216 JOB CLASS=A,RESTART=RUN.LKED //RT452216 JOB CLASS=B,RESTART=*

Restart

Page 58: JCL Presentation

Introduction to JCL

25

58

Click to edit Master title style

Specifies the priority with which jobs are selected from the queue to be executed.   It may range from 0 - 15.   If omitted, installation default is assigned.   Priority is within job class.

PRTY

Page 59: JCL Presentation

Introduction to JCL

25

59

Click to edit Master title style

PRTY=number

//RT452216 JOB (45992),’SMITH’,CLASS=M,PRTY=7

PRTY

Page 60: JCL Presentation

Introduction to JCL

25

60

Click to edit Master title style

It requests the system to send a message to your time-sharing terminal when the batch job completes.   If not online, when the job completes, the message will be saved and displayed when you next log on.

NOTIFY

Page 61: JCL Presentation

Introduction to JCL

25

61

Click to edit Master title style

NOTIFY=user-id

//RT452216 JOB (45992),’SMITH’,CLASS=A,NOTIFY=GDB10

NOTIFY

Page 62: JCL Presentation

Introduction to JCL

25

62

Click to edit Master title style

ADDRSPC=REAL locks the job or step into central storage during execution.  ADDRSPC=VIRT allows the job or step to be paged .  Default is VIRT.  Can be coded in JOB and EXEC statements.   If coded in both, JOB statement entry overrides EXEC statement entry.

The installation will control the use of ADDRSPC=REAL because of its adverse effect on the system’s performance. It is rarely used for such things as time dependent programs and those that dynamically modify channel programs during I/O operations.

ADDRSPC

Page 63: JCL Presentation

Introduction to JCL

25

63

Click to edit Master title style

ADDSPC=REAL/VIRT

//RT452218 JOB (45992),’SMITH’,ADDRSPC=REAL

ADDRSPC

Page 64: JCL Presentation

Introduction to JCL

25

64

Click to edit Master title style

Can be coded in JOB and EXEC statements.   When a condition is to be checked on all the job steps, COND is coded in the JOB statement. On the other hand, COND is coded on the EXEC statement if the conditions are specific to certain steps only.  Helps in executing the job depending upon the return code which is generated by the system after the execution of job steps.  Return codes can range from 0 to 4095. 

0 - No error4 - Possible errors detected but execution should be successful8 - Serious error detected; execution likely to fail12 - Severe error, execution impossible16 - Fatal error; execution cannot continue

COND

Page 65: JCL Presentation

Introduction to JCL

25

65

Click to edit Master title style

When COND parameter is coded on the JOB statement, the tests it specifies are applied to all job steps and any successful test causes all subsequent steps to be bypassed.   The tests are made at the end of each step against the return code of the step and any successful test causes all subsequent steps to be bypassed.   A COND parameter on the EXEC statement nullifies any COND parameters on JOB statements..

COND

Page 66: JCL Presentation

Introduction to JCL

25

66

Click to edit Master title style

COND=(number,comparison), ......)

//RT45227 JOB CLASS=A,COND=(4,LT)

COND

Page 67: JCL Presentation

Introduction to JCL

25

67

Click to edit Master title style

The TIME parameter sets a CPU time limit for an entire job when it is coded on the JOB statement.   Minutes may range from 1 to 1440 and seconds less than 60.   If the elapsed CPU time within a job exceeds the time limit for that job, the entire job is abnormally terminated with a return code of 322.   TIME coded on the EXEC statement overrides the limits set by job statement entry.

TIME

Page 68: JCL Presentation

Introduction to JCL

25

68

Click to edit Master title style

TIME=(minutes,seconds)/NOLIMIT/MAXIMUM

//RT452216 JOB (45992),’SMITH’,CLASS=A,TIME=9

//RT452216 JOB CLASS=B,TIME=(2,7)

TIME

Page 69: JCL Presentation

Introduction to JCL

25

69

Click to edit Master title style

REGION coded on the JOB statement sets the limit for all steps, overriding any region size on EXEC statement.   n in the REGION parameter is the number of 1024-byte.   If a job requires more storage than was specified by REGION, the job is abnormally terminated with an 804 completion code.

REGION

Page 70: JCL Presentation

Introduction to JCL

25

70

Click to edit Master title style

REGION=nM/nK

//RT452216 JOB (45992),’SMITH’CLASS=C,REGION=66K

REGION

Page 71: JCL Presentation

Introduction to JCL

25

71

Click to edit Master title style

EXEC Statement

Page 72: JCL Presentation

Introduction to JCL

25

72

Click to edit Master title style

Each job step begins with an EXEC statement that either names the program to be executed or invokes a cataloged procedure.  A job can contain several EXEC statements.  There may be as many as 255 EXEC statements in a job.  Each one of these is followed by DD statements defining the data sets required by the job step.

EXEC Statement

Page 73: JCL Presentation

Introduction to JCL

25

73

Click to edit Master title style

//Stepname EXEC Procedure PGM=program,Key-word Parameters

//Step1 EXEC SORT5

//Step2 EXEC PGM=L1, PARM=‘12345’

//Step3 EXEC PGM=IEFBR14

EXEC Statement

Page 74: JCL Presentation

Introduction to JCL

25

74

Click to edit Master title style

STEP NAME  Step name names the job step.  It is optional and contains 1 to 8 character alphanumeric (A-Z,0-9) or national (#@$) characters that you select.   It must begin in column 3 with an alphanumeric or national character (A-Z,@,# or $).  Step names within a job should be unique so that you can reference them in other JCL statements.  A step name is required if subsequent JCL statements refer to the job step or if you wish to restart the job from that step.

STEP NAME and PGM

Page 75: JCL Presentation

Introduction to JCL

25

75

Click to edit Master title style

Program Name  Names the program or procedure to execute.  Programs can reside in a system library named SYS1.LINKLIB, in temporary libraries and in private libraries.  If the program is not found in the libraries, the system abnormally terminates the job with an 806 completion code.

STEP NAME and PGM

Page 76: JCL Presentation

Introduction to JCL

25

76

Click to edit Master title style

//STEP5 EXEC PGM=P1//COMP EXEC PGM=IGYCRCTL//LKED EXEC PGM=IEWL

STEP NAME and PGM

Page 77: JCL Presentation

Introduction to JCL

25

77

Click to edit Master title style

A system library named SYS1.LINKLIB contains all the IBM- supplied system programs, such as compilers, linkage editor and service programs.  A program in SYS1.LINKLIB is executed by naming the program on the EXEC statement.  Private program libraries are created as output from the linkage editor.  Programs within a library must have unique names.  A private program is executed by either including a special JOBLIB DD statement or STEPLIB DD statement.

PROGRAMS IN SYSTEM/PRIVATE LIBRARIES

Page 78: JCL Presentation

Introduction to JCL

25

78

Click to edit Master title style

//ABC123 JOB (2347)’GOLD’,CLASS=A//JOBLIB DD DSN=TRGID.LINK,DISP=SHR//STEP1 EXEC PGM=IEFBR14// :// :// ://EXECUTEEXEC PGM=P1

PROGRAMS IN SYSTEM/PRIVATE LIBRARIES

Page 79: JCL Presentation

Introduction to JCL

25

79

Click to edit Master title style

The JOBLIB statement is placed immediately after the JOB statement and is effective for all the job steps.   It cannot be placed in a catalogued procedure.   In the example given we have defined 2 private libraries ABC001.PGMLIB and ABC001.LINKLIB  Programs in these steps are first searched in the private libraries given in the order in which it is defined.  If not found, the system searches SYS1.LINKLIB for the program.

JOBLIB Statement

Page 80: JCL Presentation

Introduction to JCL

25

80

Click to edit Master title style

//TRG5A JOB (234578),’TEC’,CLASS=A//JOBLIB DD DSN=ABC001.PGMLIB,DISP=SHR// DD DSN=ABC001.LINKLIB,DISP=SHR//STEP1 EXEC PGM=COMP1// :// :// ://STEP2 EXEC PGM=LINK1// :// ://STEP3 EXEC PGM=IEBGENER

JOBLIB Statement

Page 81: JCL Presentation

Introduction to JCL

25

81

Click to edit Master title style

STEPLIB DD statement, similar in form and function to the JOBLIB statement, is placed after an EXEC statement.  It is effective for that step only.  It can be placed in a catalogued procedure.  If JOBLIB and STEPLIB DD statements are both included in a job, the STEPLIB statement overrides the JOBLIB statement.

STEPLIB Statement

Page 82: JCL Presentation

Introduction to JCL

25

82

Click to edit Master title style

//TRG5A JOB (234578),’TEC’,CLASS=A//JOBLIB DD DSN=ABC001.ALINKLIB,DISP=SHR//STEP1 EXEC PGM=COMP1//STEPLIB DD DSN=ABC001A.TESTLIB,DISP=SHR// :// ://STEP2 EXEC PGM=LINK1//STEPLIB DD DSN=XYZ001.PGMLIB,DISP=SHR// :// ://STEP3 EXEC PGM=PRINTX

STEPLIB Statement

Page 83: JCL Presentation

Introduction to JCL

25

83

Click to edit Master title style

The Key-word parameters are coded on the EXEC statement following the program or procedure.  It is applied only on the step being executed.  The PGM parameter must appear first.

KEY-WORD PARAMETERS IN EXEC STATEMENT

Page 84: JCL Presentation

Introduction to JCL

25

84

Click to edit Master title style

PARM

ACCT COND

DPRTY

REGION

TIME

ADDRSPC

PERFORM

KEY-WORD PARAMETERS IN EXEC STATEMENT

Page 85: JCL Presentation

Introduction to JCL

25

85

Click to edit Master title style

It is used to pass control information to the job step when the step is initiated.  This can be extremely useful for passing run-time information to an application program.  There may be 1 to 100 characters of data in the PARM.   If the value consists of several sub-values separated by commas, or if it contains special characters, enclose the value in apostrophes. Code the legitimate apostrophe as two consecutive apostrophes.  Programs supplied by IBM such as the compilers and linkage editors, expect the value to represent various run options.  If we have to pass values to a COBOL program, it should have the Linkage Section through which it receives the value.

PARM statement

Page 86: JCL Presentation

Introduction to JCL

25

86

Click to edit Master title style

PARM = Value

//STEP1 EXEC PGM=ONE,PARM=(‘K=6’,’I=3’,‘J=4’) //STEP2 EXEC COB2UCLG,PARM.GO=‘STRING’

PARM statement

Page 87: JCL Presentation

Introduction to JCL

25

87

Click to edit Master title style

Any accounting information for job steps must be defined by the installation.  It may have one or more sub-parameters separated by commas.  If it contains any special characters, enclose the sub-parameters in apostrophes.  If coded in the EXEC statement, it overrides the JOB statement.

ACCT Parameter

Page 88: JCL Presentation

Introduction to JCL

25

88

Click to edit Master title style

ACCT = (accounting information)

//STEP10 EXEC PGM=ONE, ACCT=(3784,45-96)

//COMP EXEC PGM=L1,ACCT=24573

ACCT Parameter

Page 89: JCL Presentation

Introduction to JCL

25

89

Click to edit Master title style

If the step name is not given in the condition, the number is compared against the return code from each prior step. If the condition is true the step is bypassed.  If the step name is given in the condition, the number is compared against the return code of a specific step.  If more than one condition is specified all of them are checked.

A maximum of 8 conditions can be checked in any one step.

COND PARAMETERCOND Parameter

Page 90: JCL Presentation

Introduction to JCL

25

90

Click to edit Master title style

COND=(number,comparison) (or) COND=(number,comparison,stepname)

//STEPA EXEC PGM=ONE,COND=(4,GT)//STEPAA EXEC PGM=TWO,ACCT=14578,COND=(8,EQ,STEPA)//STEPB EXEC PGM=TWO,PARM=‘4567’,COND=((4,GT),(6,LT))

COND Parameter

Page 91: JCL Presentation

Introduction to JCL

25

91

Click to edit Master title style

If a step is not executed, it does not return a return code. If a subsequent step tries to test the return code from a step that was not executed, the test is simply not performed.  If a step abnormally terminates, no return code can be issued and all subsequent steps are bypassed, unless the EVEN or ONLY subparameters are used.  COND=EVEN permits the job step to execute even if previous steps abnormally terminate.  COND=ONLY causes the step to execute only if the previous step abnormally terminates.

COND Parameter and its Sub parameters

Page 92: JCL Presentation

Introduction to JCL

25

92

Click to edit Master title style

COND=ONLY/EVEN

//STEP5 EXEC PGM=GO,COND=ONLY

//STEP7 EXEC PGM=PGM3,COND=EVEN

COND Parameter and its Sub Parameters

Page 93: JCL Presentation

Introduction to JCL

25

93

Click to edit Master title style

Specifies the amount of storage a job step can use.   REGION on EXEC statement sets the limit for a specific step.   REGION on JOB statement overrides REGION on EXEC.   If a job step requires more storage than was specified by REGION, the job is abnormally terminated.   REGION=0K or REGION=0M will request for all available storage.

REGION statement

Page 94: JCL Presentation

Introduction to JCL

25

94

Click to edit Master title style

REGION=nK/nM

//COMPU EXEC PGM=GO,REGION=1000K

//CALC EXEC PGM=PGM1,REGION=1M

REGION statement

Page 95: JCL Presentation

Introduction to JCL

25

95

Click to edit Master title style

This sets a CPU time limit for a specific step.   CPU time is the time taken by a job while executing instructions. It does not include wait time or system time.   Minutes may range from 1 to 1440 (24 hours), seconds must be less than 60.   If the elapsed CPU time within a step exceeds the time limit for that step, the entire job is abnormally terminated with a 322 completion code.

TIME statement

Page 96: JCL Presentation

Introduction to JCL

25

96

Click to edit Master title style

TIME=minutes

TIME=(minutes,seconds)

TIME=NOLIMIT

TIME=MAXIMUM

//STEP5 EXEC PGM=FIRST,TIME=(10,3) //STEP8 EXEC PGM=LAST,TIME=8

TIME statement

Page 97: JCL Presentation

Introduction to JCL

25

97

Click to edit Master title style

Prevents a job step from being paged.   ADDRSPC=REAL locks the step into central storage during creation.   ADDRSPC=VIRT allows the step to be paged. This is the default.

ADDRSPC statement

Page 98: JCL Presentation

Introduction to JCL

25

98

Click to edit Master title style

ADDRSPC=VIRT/REAL

//STEP10 EXEC PGM=ABC,ADDRSPC=REAL

ADDRSPC statement

Page 99: JCL Presentation

Introduction to JCL

25

99

Click to edit Master title style

IF/THEN/ENDIF provides a simple means of selectively executing job steps.  The THEN and ENDIF are always required. The ELSE is optional.  JOB, JCLLIB or JOBLIB statements cannot follow a THEN or ELSE.  Mnemonic operators that can be used are NOT, EQ, NE, GT, LT, GE, NL, LE, NG, AND, OR.  The NOT operator can be coded outside of the left parenthesis to reverse the result of relational expression.

IF statement

Page 100: JCL Presentation

Introduction to JCL

25

100

Click to edit Master title style

The NOT has the highest priority, the comparisons the second highest, and the AND and OR have the lowest. You can use parenthesis to specify the hierarchy you want.  If step name is given along with RC, the test is made with the return code of the previous step.  If step name is not given, the test is made with the highest return code from all previous steps.  It is possible to nest IF/THEN/ENDIF statements up to 15 levels.

IF statement

Page 101: JCL Presentation

Introduction to JCL

25

101

Click to edit Master title style

// IF (relational-expression) THEN{JCL statements to execute if the relational expression is true}

// ELSE{JCL statements to execute if the relation expression is false}

// ENDIF

// IF (STEPA.RC GE 4 AND STEPA.RC LE 6) THEN//STEP1 EXEC PGM=ONE// :// :// ENDIF

IF statement

Page 102: JCL Presentation

Introduction to JCL

25

102

Click to edit Master title style

DD Statement

Page 103: JCL Presentation

Introduction to JCL

25

103

Click to edit Master title style

A DD (Data Definition) Statement is used to identify the source of input and the placement of output. The DD statement must immediately follow the EXEC statement.

Syntax:

//ddname DD positional/keyword parameters

Rules for coding DD statement:

The ddname identifies the name of the data definition statement. A valid ddname must be assigned to each dataset used.

DD name must be 1 to 8 alpha numeric or National (@, $, #). The first character must be alphabetic or national.

DD statement

Page 104: JCL Presentation

Introduction to JCL

25

104

Click to edit Master title style

Each DD name within a step should be unique.  When we execute a COBOL program through JCL the physical file name in the SELECT statement of the COBOL program should be used as DD name in the JCL.

DD statement

Page 105: JCL Presentation

Introduction to JCL

25

105

Click to edit Master title style

Positional parameters may be coded in the operands field. The following positional parameters may be coded

//ddname DD *//ddname DD DATA//ddname DD DUMMY

Keyword parameters may also be coded in the operands field. The following are the most commonly used.

DSNDISPUNITSPACEVOLUMELABELDCB

DD statement

Page 106: JCL Presentation

Introduction to JCL

25

106

Click to edit Master title style

The DSN parameter names the data set.  Data sets can be temporary or non-temporary.  A temporary data set is created and deleted within the job, whereas non- temporary data sets can be retained after the job completes.  A data set is marked temporary by either omitting the DSN parameter or by coding DSN=&&name.  If the data set is already defined in any previous steps, it can be referred back.

Data set names that are referred back will take the format as below :DSN=*.stepname.ddname

 

DSN Parameter

Page 107: JCL Presentation

Introduction to JCL

25

107

Click to edit Master title style

  A non-temporary data set is denoted by coding DSN=data set name where data set name can be qualified or non-qualified.

Non-qualified Names:Non-qualified names are comprised of 1 to 8 alphanumeric or national Characters. The first character must be alphabetic or national. It is impossibleto catalogue these datasets

Example:DSN=FILE1

Qualified Names:Qualified names consists of two or more non-qualified names, each separatedFrom the next by a period. The first name is called the highest qualifier of thatname. The maximum length of the data set name including the periods is 44 characters.

DSN Parameter

Page 108: JCL Presentation

Introduction to JCL

25

108

Click to edit Master title style

Example:DSN=DEVVHEG.DATA.REPORT

The DSN parameter for partitioned data sets must include the member name to refer to an individual member within a data set.

TEMPORARY DATASETS

Datasets can be temporary or Permanent. A Temporary data set is created during a job execution and deleted after a job completion.

Temporary datasets can be coded in two different ways

1) By omitting the DSN parameter – In this case the system assigns a unique name to it, and reference is made to it by referencing the step name and ddname. This is called refer back.

DSN Parameter

Page 109: JCL Presentation

Introduction to JCL

25

109

Click to edit Master title styleDSN Parameter

Example:

//JOB1 JOB ‘A123’, ‘THIRU’

//STEP1 EXEC PGM=PROGRAM1

//DATA1 DD DSN=A.B.C,DISP=SHR

//DATA2 DD

//STEP2 EXEC PGM=PROGRAM2

//DATA1 DD *.STEP1.DATA2,DISP=SHR

//DATA2 DD DSN=ABC.DEF.GHI,DISP(NEW,CATLG,DELETE)

2) By Coding the DSN parameter – In this case the dataset name must start with two ampersands (&&) followed by 1 to 8 characters alphanumeric or national characters. The first character must be alphabetic or national.

Example://JOB1 JOB ‘A123’, ‘THIRU’

//STEP1 EXEC PGM=PROGRAM1

//DATA1 DD DSN=&&TEMPDATA

Page 110: JCL Presentation

Introduction to JCL

25

110

Click to edit Master title style

DISP parameter has 3 positional parameters as values.

DISP = (status, normal-disposition, abnormal-disposition)

Status indicates the current status of the dataset. It can take values like : NEW - Creates a data set MOD - Either extends an existing data set or creates a new data set if it does not exist. The read/write mechanism is positioned

after the last record in the data set when the data set is opened when use MOD.

OLD - Designates an existing data set. It can be an input data set to be read or an output data set to be rewritten.

SHR - Permits old data sets to be shared. SHR is identical to OLD except that several jobs may read the data set concurrently in multiprogramming environments. SHRing is used for all input data sets.

DISP Parameter

Page 111: JCL Presentation

Introduction to JCL

25

111

Click to edit Master title style

NORMAL DISPOSITION

The normal disposition field in the DISP parameter is used to indicate what to do with the dataset upon normal termination of the job. The following sub parameters can be coded

PASS – The data set is to be passed to a subsequent job step with in a same job. Both temporary and non-temporary data sets can be passed.

KEEP – This KEEP sub parameter indicates that the data set is to be retained or kept upon successful execution of the job.

DELETE – This sub parameter indicates that the dataset being referenced is to be deleted after successful termination of the Job.

DISP Parameter

Page 112: JCL Presentation

Introduction to JCL

25

112

Click to edit Master title style

CATLG – The CATLG sub parameter is used to specify that the dataset is to be retained and recorded in the system catalogues after successful termination of the job. The dataset name, unit, volume are recorded. If CATLG is attempted for temporary datasets, the DISP is changed to PASS.

UNCATLG – The UNCATLG sub parameter is used to remove the entry of the dataset from the system catalogs.

ABNORMAL DISPOSITION:The abnormal disposition field tell the system what to do with the dataset uponAbnormal termination of the Job. The following subparameteres can be used

DELETE KEEP

CATLGUNCATLG

DISP Parameter

Page 113: JCL Presentation

Introduction to JCL

25

113

Click to edit Master title style

UNIT parameter conveys information about the input or output devices that will be used by the job

Syntax:UNIT=device-addressUNIT=device-typeUNIT=device-group-name

SPECIFICATION OF DEVICE ADDRESS:Each I/O device attached to a computer assigned a hardware address when a System is generated. Device addresses are expressed as three hexadecimalDigits. This kind of specification rarely used.

Example://JOB1 JOB ‘A123’, ‘THIRU’//STEP1 EXEC PGM=PROGRAM1//DATA1 DD DSN=FILE1, UNIT=S04

UNIT Parameter

Page 114: JCL Presentation

Introduction to JCL

25

114

Click to edit Master title styleUNIT Parameter

SPECIFICATION OF DEVICE TYPE:A device type is identified by the model number assigned to that device.

Syntax://JOB2 JOB ‘A123’, ‘THIRU’//STEP1 EXEC PGM=PROGRAM2//DATA1 DD DSN=FILE2, UNIT=3380

SPECIFICATION OF DEVICE GROUP:A device group name is symbolic name which is assigned to a group of devices when the system is generated. Devices are often grouped together based on their function.

For example, you can have all direct access storage devices are under one group SYSDA, tape devices are under one group SYSTAPE, and temporary storage devices are under one group SYSTEMP and so on.

Page 115: JCL Presentation

Introduction to JCL

25

115

Click to edit Master title style

The VOL parameter requests a specific volume, multiple volumes and specific volumes of a multi-volume cataloged data set.  A volume is the portion of a storage device served by one read/write mechanism, such as a tape reel or disk pack.  Each volume has a label. The volume label contains the volume serial number and is read by the system to ensure that an expected volume is actually mounted.

VOLUME Parameter

Page 116: JCL Presentation

Introduction to JCL

25

116

Click to edit Master title style

VOl=SER=(volume, . . . . ,volume)

VOL=SER=XT4321

VOL=SER=PACK02

VOLUME Parameter

Page 117: JCL Presentation

Introduction to JCL

25

117

Click to edit Master title style

The LABEL parameter indicates the type of label, the relative file number on the tape, and whether the data set is to be protected from input or output and its retention period.  For files on a tape the proper data set sequence number must be specified.  Type may be SL(Standard Labels) or NL(No labels) etc.

RETPD / EXPDT is to assign a date after which the data set can be modified / deleted.

LABEL ParameterLABEL Parameter

Page 118: JCL Presentation

Introduction to JCL

25

118

Click to edit Master title style

Syntax:

LABEL=(sequence-number,type-of-label,pw,RETPD=nnnn / EXPDT=yyddd)

Sequence-numberTape datasets can be identified by their sequence number. The sequence number is a 4 digit number and describes the datasets position relative to otherdataset that may exist on the volume. This number can range from 1 to 9999,Where number 1 indicates the first dataset on the tape. If this parameter is notCoded it defaults to 1.

Type-of-labelType of label can be SL (Standard IBM Label), NSL (Non Standard Label, also called user defined label), SUL (LABEL=RETPD=140LABEL=EXPDT=20230

LABEL Parameter

Page 119: JCL Presentation

Introduction to JCL

25

119

Click to edit Master title style

The Space Parameter is used to allocate storage for new data sets on direct Access storage.Syntax:

SPACE=(CYL,(Primary,Secondary,Directory),RLSE,CONTIG,MXIG,ROUND)SPACE=(TRK,(Primary,Secondary,Directory),RLSE,CONTIG,MXIG,ROUND)SPACE=(BLK,(Primary,Secondary,Directory),RLSE,CONTIG,MXIG,ROUND)

Space may be requested in tracks, cylinders or blocks.

 Primary is the number indicating the amount of storage space requested.  

Secondary is the number indicating the amount of storage space requested in case of primary space allocated is insufficient. The Secondary space can be allocated 15 times.

Directory is the number indicating the amount of storage space for recording of name and location of members created with in the partition dataset. One directory block contains 256 bytes.

SPACE Parameter

Page 120: JCL Presentation

Introduction to JCL

25

120

Click to edit Master title style

RLSE is used to release all unused space when a data set is closed.

CONTIG is used to request that the primary space to be allocated only on contiguous tracks and cylinders. This parameter applies to only primary space. CONTIG is rarely used.  MXIG allocates the primary space as the largest contiguous free area on a volume, but only if that area is as large or larger than the amount requested. MXIG is rarely used.

ROUND lets you request space in units of block size, but allocates the space on cylinder boundaries, as if CYL had been coded.  The SPACE parameter is ignored for non-direct-access volumes such as tapes.

SPACE Parameter

Page 121: JCL Presentation

Introduction to JCL

25

121

Click to edit Master title style

The Data Control Block (DCB) is a keyword parameter coded on the DD Statement.

Syntax

DCB=(RECFM=format, LRECL=record-length, BLKSIZE=block-size)

The RECFM parameter is used to specify to the operating system, the record format of the dataset being created. Record format can be of a fixed length (F OR FB), variable length (V OR VB), or undefined (U) length.

The LRECL parameter is used to specify the length of the record for fixed and variable length records. For fixed length records, LRECL is set to equal to the record length since all the records are in same length. For Variable length records, LRECL is set to equal to the size of largest record plus four bytes. The first four bytes of the each record will have control information

DCB ParameterDCB Parameter

Page 122: JCL Presentation

Introduction to JCL

25

122

Click to edit Master title style

LRECL shows the length of a record in terms of bytes.  BLKSIZE is used to specify the block size. The block size should be same as record length or multiples of record length for fixed length records.  The block size should be same as record length plus four bytes or multiples of record length plus four bytes for variable length records.

BLKSIZE can not be larger than the track size of the direct access volume on which the data will reside.

DCB Parameter

Page 123: JCL Presentation

Introduction to JCL

25

123

Click to edit Master title style

The dummy parameter is coded on the DD statement to test the execution of a program with out actually reading or writing to a dataset. It causes the operating system to simulate the presence of a file without it actually being there.

Syntax://DDNAME DD DSN=NULLFILE

OR//DDNAME DD DUMMY

A data set is assigned a dummy status by coding either DUMMY as the first parameter in DD statement or DSN=NULLFILE. If a DUMMY or NULLFILE is read, then the operating system passes an end-of-file indicator to the program that it is being executed. If write requests are issued to these imaginary files, they are simply ignored.

DUMMY Data Sets

Page 124: JCL Presentation

Introduction to JCL

25

124

Click to edit Master title style

//SYSPRINT DD DUMMY

[Any output produced by SYSPRINT is suppressed]

//SYSIN DD DUMMY

[Any attempt to read data from SYSIN results in an immediate end-of-file exit]

//OUT DD DUMMY

[The file OUT is not considered for any operation]

DUMMY Data Sets

Page 125: JCL Presentation

Introduction to JCL

25

125

Click to edit Master title style

Several input data sets can be read in sequence as if they were a single data set, by concatenating them.  Data sets are concatenated by coding a DD statement for each data set in the order they are to be read.  All datasets concatenated together must have the same type of record format and LRECL.

All dataset concatenated together must exist on the same type of device.

All datasets concatenated together must be of the same type. For example partitioned dataset can be concatenated only with partitioned dataset.

Up to 255 sequential data sets can be concatenated together and 16 partitioned datasets can be concatenated together.

CONCATENATING Data Sets

Page 126: JCL Presentation

Introduction to JCL

25

126

Click to edit Master title style

//JOB1 JOB ‘A123’, ‘THIRU’

//STEP1 EXEC PGM=PGM1

//IN DD DSN=JAN.DATA,DISP=SHR

// DD DSN=FEB.DATA,DISP=SHR

// DD DSN=MAR.DATA,DISP=SHR

CONCATENATING Data Sets

Page 127: JCL Presentation

Introduction to JCL

25

127

Click to edit Master title style

SYSPRINT is a special DD name that directs the output either to a file or to various output devices.  SYSUDUMP is a DD name which provides a formatted dump of the program area in hexadecimal, including the contents of registers, a trace back of sub-routines called, and information about all the data sets used.  The SYSABEND DD name additionally dumps the system nucleus - the resident portion of the Operating System. This parameter is only used for system programmers.  A dump results only if the step abnormally terminates.

DCB ParameterSYSPRINT, SYSABEND, SYSUDUMP DD names

Page 128: JCL Presentation

Introduction to JCL

25

128

Click to edit Master title style

//SYSPRINT DD DSN=TRG5.SYSINFO(M3),DISP=OLD

[write the system output into the member M3 of a PDS]

//SYSUDUMP DD SYSOUT=A

[writes the dump of the user region of your job’s private address space]

//SYSABEND DD SYSOUT=A

[writes the dump of the user region as well as system areas outside the

User region associated with your JOBSTEP]

SYSPRINT, SYSABEND, SYSUDUMP DD names

Page 129: JCL Presentation

Introduction to JCL

25

129

Click to edit Master title style

SYSIN is used as a DD name for lines of data in the input stream. /* marks the end of the lines.

This can’t be coded in catalogued procedure.  The lines of data cannot contain // or /* in columns 1 and 2 if DD * is used. If the lines contain // and /*in columns 1 and 2, code DATA in place of *.

//ddname DD *// :// :/*

//ddname DD DATA// :// :/*

INPUT Stream of data

Page 130: JCL Presentation

Introduction to JCL

25

130

Click to edit Master title style

The SYSOUT parameter is used to direct the output that is generated during the execution of a job to an output device.

A set of output devices may be groped together under a specific class name.

If * is given, it refers back to the device in MSGCLASS.

Syntax:

//ddname DD SYSOUT=CLASS

Examples://JOB1 JOB ‘A123’,’THIRU’,CLASS=K,MSGCLASS=A//STEP1 EXEC PGM=PGM1//FILE1 DD DSN=ABC.DEF.GHI,DISP=SHR//SYSPRINT DD SYSOUT=*

SYSOUT ParameterSYSOUT Parameter

Page 131: JCL Presentation

Introduction to JCL

25

131

Click to edit Master title style

NULL statement indicates the end of the job.  Any statement after this statement is ignored.

//[two slashes indicate the NULL Statement]

//MYJOB JOB . . . . . // :// ://MYFILE DD . . . . . .//

NULL Statement

Page 132: JCL Presentation

Introduction to JCL

25

132

Click to edit Master title style

PROCEDURES

Page 133: JCL Presentation

Introduction to JCL

25

133

Click to edit Master title style

JCL statements that have potential use by several users are often placed in a procedure and given them a name. There are two types of Procedures

Catalogued procedures are stored as members of partitioned data sets.

In-stream procedures are identical to catalogued procedures except that they are placed with in the job, immediately after the JOB

statement and it ends with a PEND statement.  In-stream procedures are used to test JCL before placing it in a catalogued procedure. They are also used for procedures of limited use.  There can be a maximum of 15 in-stream procedures per job.

Catalogued and In stream Procedures

Page 134: JCL Presentation

Introduction to JCL

25

134

Click to edit Master title style

Syntax:

//Procedure-name PROC symbolic-parameters

//STEP1..

//STEP2..

Example:

//ADDPROC PROC

//STEP1 EXEC PGM=IEBGENER

//SYSPRINT DD SYSOUT=*

//SYSUT1 DD . . . . . . . . .

/SYSUT2 DD . . . . . . . . .

Catalogued and In stream ProceduresCatalogued Procedures

Page 135: JCL Presentation

Introduction to JCL

25

135

Click to edit Master title style

Invoking the Proc in the JCL with a single EXEC statement along with the procedure name.

Syntax:

// EXEC procedure name

Example:

// EXEC ADDPROC

Invoking a Catalogued Procedure

Page 136: JCL Presentation

Introduction to JCL

25

136

Click to edit Master title style

Procedures can contain all but the following JCL statements :

JOB, delimiter (/*) or null (//) statements

JOBLIB statements

DD * or DATA statements

Any JES2 or JES3 control statements

Limitations of Procedures

Page 137: JCL Presentation

Introduction to JCL

25

137

Click to edit Master title style

Catalogued procedures are normally kept in a System Library named SYS1.PROCLIB, but other libraries may be concatenated to it.  The JCLLIB Statement allows the user to store catalogued procedures in their own library as members of a PDS.  The PDS must be catalogued and have DCB attributes of LRECL=80 and RECFM=F or FB. Then the user names the library with a JCLLIB Statement.  There can be only one JCLLIB per job and it is placed after the JOB statement but before the first EXEC statement. One or more libraries are listed in the order the user wants them to be searched.

JCLLIB Statement

Page 138: JCL Presentation

Introduction to JCL

25

138

Click to edit Master title style

//JCLLIB order=(data-set-name, data-set-name, . .,data-set-name)

//RT452216JOB (45992),’SMITH’,CLASS=A

//JCLLIB ORDER=(A0000.LIB1.TEST,A0000.LIB1.PROD)

//STEP1 EXEC DOIT

JCLLIB Statement

Page 139: JCL Presentation

Introduction to JCL

25

139

Click to edit Master title style

Symbolic Parameters are used to override parameters on the DD statement.   Can be used in Both Catalogued and In-stream Procedures.

Symbolic Parameter on a DD statement is coded by preceding the parameter that will be assigned a value with an ampersand (&).

Rules for Coding Symbolic Parameters:

A symbolic Parameter consist of one to eight alphanumeric or national (#@$) characters including the ampersand (&).  The first character must be an ampersand. The next character must be alphabetic or national.

Symbolic Parameters must be coded in the operands field only. They can not be coded for the keywords on the exec statement. Examples of keywords on the exec statement are PGM, COND, TIME and PARM. How ever they may be coded for the values associated with it.

SYMBOLIC PARAMETERSSymbolic Parameters

Page 140: JCL Presentation

Introduction to JCL

25

140

Click to edit Master title styleSymbolic Parameters

If a positional parameters are coded as symbolic then a period should be inserted between them. This period is in addition to any periods that would be required for the correct syntax of the statement that is being coded.   

Symbolic Parameters cannot be concatenated with other symbolic parameters to produce yet another symbolic parameters. However they can be concatenated with each other, each retaining the value originally assigned to it.

Page 141: JCL Presentation

Introduction to JCL

25

141

Click to edit Master title style

//JOB1 JOB ‘A123’, PGM=‘THIRU’ //PROCLIB JCLLIB ORDER=(DEVVHEG.TRAINING.LIB),DISP=SHR//PROCSTP PROC1 SPCTYPE=CYL,// FORMAT=FB,// USERID=DEVVHEG,// UNIT=SYSDA//

//PROC1 PROC//STEP1 EXEC PGM=PROGRAM1//DD1 DD DSN=&USERID..DATA.REPORT,// DISP=(NEW,CATLG,DELETE),// UNIT=&UNIT,// SPACE=(&SPCTYPE,(1,1),RLSE),// DCB=(RECFM=&FORMAT,LRECL=100,BLKSIZE=0)

Symbolic Parameters

Page 142: JCL Presentation

Introduction to JCL

25

142

Click to edit Master title style

Symbolic parameters must always be given values,either on the proc statement as part of the procedure or on the EXEC statement when you are invoking the procedure.

Values can also be assigned to symbolic parameters using the set statement.

Any values coded on the EXEC or SET statement override the values on the PROC statement for the duration of the run.

If more than one value is assigned to a symbolic parameter on a PROC or EXEC statement, only the first is used.

Symbolic parameters may be coded in any order on PROC or EXEC statements.

Assigning Values to Symbolic Parameters

Page 143: JCL Presentation

Introduction to JCL

25

143

Click to edit Master title styleAssigning Values to Symbolic Parameters

Values containing special characters must be enclosed in apostrophes. It can be of any length, but it cannot be continued onto another line.

We can nullify symbolic parameters by coding the keyword and equal sign without a value

Page 144: JCL Presentation

Introduction to JCL

25

144

Click to edit Master title style

Parameters on DD statement in procedures can be overridden or an entire DD statement can be added

The stepname is placed in front of the DD name to override or to add DD statements in procedures.

If the DD name of the submitted statement matches a DD name within the procedure, parameters on the DD statement are overridden. If the names do not match,the submitted statement is added

DD statements must be overridden in the order they appear in the procedure and added DD statements must follow any overriding statement. But the parameters in the DD statement can be in any order, those appearing the procedure are overridden, those not appearing are added

Overrides Parameter

Page 145: JCL Presentation

Introduction to JCL

25

145

Click to edit Master title style

The changes made to a catalogued procedure by overriding DD statements are effective only for the run and do not change the catalogued procedure permanently

A stepname prefixed to a DD name has no effect if a catalogued procedure is not invoked

Concatenated DD statements within a catalogued procedure must be overridden individually in the same order they appear in the procedure.

Overrides Parameter

Page 146: JCL Presentation

Introduction to JCL

25

146

Click to edit Master title style

Example for Override Parameter:

//PROC123 PROC//STEP1 EXEC PGM=PROGRAM1//DD1 DD DSN=FILE1,DISP=SHR//STEP2 EXEC PGM=PROGRAM2//DD2 DD DSN=FILE2,DISP=SHR

//JOB1 JOB ‘A123’,’THIRU’//PROCLIB JCLLIB ORDER=A.B.C,DISP=SHR//PROC1 EXEC PROC123//STEP1.DD1 DD DSN=FILE3,DISP=OLD//STEP2.DD2 DD DSN=FILE4,DISP=SHR

Overrides Parameter

Page 147: JCL Presentation

Introduction to JCL

25

147

Click to edit Master title styleGeneration Data GroupGeneration Data Group

A GDG is a Data Group is a group of datasets which are related to each other chronologically and functionally.

All the datasets with a GDG will have the same name.

The generation number of a dataset with a GDG is automatically assigned by the operating system when it is created.

The Syntax of the generation number is GaaaaVnn

Where G is for generation, aaaa is absolute sequence number can range From 0000 to 9999, V is version and nn is a version number can range from 00 to 99

Page 148: JCL Presentation

Introduction to JCL

25

148

Click to edit Master title styleGeneration Data Group

Parameters of a GDG

DEFINE GDG ( NAME (gname) LIMIT (limit) [EMPTY | NOEMPTY] [OWNER(owner id)] [SCRATCH | NOSCRATCH])

Page 149: JCL Presentation

Introduction to JCL

25

149

Click to edit Master title style

UTILITY Programs

Page 150: JCL Presentation

Introduction to JCL

25

150

Click to edit Master title style

A set of coded and tested programs that perform a variety of useful functions.   Utility programs are controlled by two types of statements : JCL Statements and Utility Control Statements   Utility Control statements do not start with //. It must be coded in columns 2 through 71. It is coded immediately after //SYSIN DD Statement.     //SYSIN DD DUMMY is coded if no editing is required.  

Standard IBM Utility Programs

Page 151: JCL Presentation

Introduction to JCL

25

151

Click to edit Master title style

SORT, IEBGENER, IEFBR14, IDCAMS

These utilities are executed by the same general JCL statements

//stepname EXEC PGM=program-name

//SYSPRINT DD SYSOUT=A { prints the utility messages }

//SYSUT1 DD . . . {If needed, describes an input data set}

//SYSUT2 DD . . . {If needed, describes an output data set}

//SYSIN DD *

{control statements}

/*

Standard IBM Utility Programs

Page 152: JCL Presentation

Introduction to JCL

25

152

Click to edit Master title style

SORT program is used to SORT/MERGE the records in one or more files and the output is stored in a new file.   SORTLIB is a PDS that contains modules required by the SORT/MERGE program. Normally, SYS1.SORTLIB   SORTIN gives the input file for a SORT/MERGE operation.    SORTOUT gives the output file for a SORT/MERGE operation.

  SORTWKnn-sort work files- n should be a consecutive number beginning with 01. One or two files are usually adequate. The total DASD space allocated to SORTWKnn data sets should be about twice the sum of the input file size.

SORT Utility

Page 153: JCL Presentation

Introduction to JCL

25

153

Click to edit Master title style

SORT and MERGE control statements SORT FIELDS=(Position,Length,Format,Sequence…) FIELDS=(Position,Length,Sequence…),FORMAT=Format MERGE FIELDS=(Position,Length,Format,Sequence…) FIELDS=(Position,Length,Sequence…),FORMAT=Format

The INCLUDE and OMIT statements

INCLUDE COND = (Position,Length,Format,Comparision Operator,Field or Constant)OMIT

SORT Utility

Page 154: JCL Presentation

Introduction to JCL

25

154

Click to edit Master title style

The INREC and OUTREC statements

INREC FIELDS = ( [constant , ]position, length[,align,]…) OUTREC

The SUM statement

SUM FIELDS = ( position , length , format…) NONE

SORT Utility

Page 155: JCL Presentation

Introduction to JCL

25

155

Click to edit Master title style

IEBGENER is used to copy the sequential data set from one device to another.

IEBGENER Utility

//stepname EXEC PGM=IEBGENER//SYSPRINT DD SYSOUT=A//SYSUT1 DD . . . . . [SYSUT1 describes the input data set. It may be concatenated]//SYSUT2 DD . . . . . [SYSUT2 describes the output data set. The DCB parameters are copied from the SYSUT1 data set if the DCB parameter is not coded]//SYSIN DD DUMMY[Since there are no control statements SYSIN is made a dummy data set]

Page 156: JCL Presentation

Introduction to JCL

25

156

Click to edit Master title style

IEFBR14 is used to create, catalogue, uncatalogue or delete a data set.   A new data set can be created by specifying DISP=(NEW,KEEP) or DISP=(NEW,CATLG)   An existing data set can be deleted or uncatalogued by specifying DISP=(OLD,DELETE) or DISP=(OLD,UNCATLG)

//STEPNAME1 EXEC PGM=IEFBR14//DDNAME1 DD DSN= ABCDATA.DATA.SET,DISP=(MOD,DELETE)

IEBR14 Utility

Page 157: JCL Presentation

Introduction to JCL

25

157

Click to edit Master title style

The IDCAMS (also know as Access Method Services) is a versatile Utility that can be invoked in batch mode with JCL or interactively withTSO commands.

This utility can be used to perform the following functionso Create/delete GDG Bases or VSAM objectso Load and Unload VSAM datasetso Listing Catalogue Informationo Copy datasetso Modify attributes of datasets

//DEFVSAM JOB//STEP1 EXEC PGM= IDCAMS

IDCAMS Utility

Page 158: JCL Presentation

Introduction to JCL

25

158

Click to edit Master title style

A FEW UTILITY PROGRAMS

• IEBCOPY

• IEHMOVE

• IEBPTPCH

• IEBUPDTE • IEBCOMPR

• IEHLIST

Utility Programs