51
JCL Day 1

JCL Day 1. 2 Copyright © 2005, Infosys Technologies Ltd ER/CORP/CRS/OS02/003 Version No: 1.0 Course Plan Day 1 :Introduction to JCL, JOB & EXEC statement,

Embed Size (px)

Citation preview

JCL

Day 1

2Copyright © 2005, Infosys Technologies Ltd

ER/CORP/CRS/OS02/003Version No: 1.0

Course Plan

Day 1 : Introduction to JCL, JOB & EXEC statement , JES commands

Day 2 : DD statements, JCL Procedures & IBM Utilities

Day 3 : Introduction to VSAM, GDG & SMS

3Copyright © 2005, Infosys Technologies Ltd

ER/CORP/CRS/OS02/003Version No: 1.0

Pre-requisites

• MVS Operating system and its subsystem TSO

• Navigating through ISPF

4Copyright © 2005, Infosys Technologies Ltd

ER/CORP/CRS/OS02/003Version No: 1.0

Topics beyond the scope

• VSAM file-handling

• User coded COBOL program execution

5Copyright © 2005, Infosys Technologies Ltd

ER/CORP/CRS/OS02/003Version No: 1.0

Evaluation Mechanism

Component Marks Schedule

Test 100 After Day 3

6Copyright © 2005, Infosys Technologies Ltd

ER/CORP/CRS/OS02/003Version No: 1.0

References

Title Author Publisher

OS/390 and z/OS JCL

Raul Menendez Murach

MVS JCL Doug Lowe Mike Murach & Associates, Inc

MVS/VSAM Gary D Brown & S.A.M. Smith

SPD

IBM Online manuals

7Copyright © 2005, Infosys Technologies Ltd

ER/CORP/CRS/OS02/003Version No: 1.0

Agenda for Day 1 Introduction to JCL

What is JCL Why we need JCL How we can use it

Sequence & priority of execution

Job statement Syntax Parameters

Exec statement Syntax Parameters COND parameter

JES commands, JCL errors & Abends

8Copyright © 2005, Infosys Technologies Ltd

ER/CORP/CRS/OS02/003Version No: 1.0

J C L

JOB CONTROL LANGUAGE

What does JCL stand for ?

9Copyright © 2005, Infosys Technologies Ltd

ER/CORP/CRS/OS02/003Version No: 1.0

What is JCL then?

• Not a Procedural or OO Language

• JOB CONTROL LANGUAGE

• Interface between Programs & MVS OS.

• Why JCL?

• Sample JCL code

10Copyright © 2005, Infosys Technologies Ltd

ER/CORP/CRS/OS02/003Version No: 1.0

Sample JCL

//UseridJ JOB ,,NOTIFY=&SYSUID,CLASS=D,

// MSGLEVEL=(1,1),MSGCLASS=X

//* SAMPLE JCL

//STEP1 EXEC PGM=SEQPROC

//STEPLIB DD DSN=OPERN.CICS3.LOADLIB,DISP=SHR

//SYSPRINT DD SYSOUT=*

//INFILE DD DSN=YourMainframeId.JCL.DAY2.FILE1,DISP=SHR

//OUTFILE DD DSN=YourMainframeId.JCL.DAY2.FILE2,

// DISP=(NEW,CATLG,DELETE),

// UNIT=SYSDA,SPACE=(TRK,(10,5),RLSE),

// DCB=(LRECL=80,BLKSIZE=8000,RECFM=FB)

11Copyright © 2005, Infosys Technologies Ltd

ER/CORP/CRS/OS02/003Version No: 1.0

Various stages of JCL execution

Determinethejob

CreatetheJCL

Submitthe

JOB

JESinterpretsJCL andpasses it

toMVS

MVS doesthe work

UserViews andInterprets

output

JEScollects

the outputand information

aboutthe JOB

SystemMessages

12Copyright © 2005, Infosys Technologies Ltd

ER/CORP/CRS/OS02/003Version No: 1.0

Various stages of JCL execution

• Input

• Conversion

• Execution

• Output

• Hard copy

• Purge

13Copyright © 2005, Infosys Technologies Ltd

ER/CORP/CRS/OS02/003Version No: 1.0

INPUT

INPUT

SPOOL

JCLSYSIN

JES

MVS

14Copyright © 2005, Infosys Technologies Ltd

ER/CORP/CRS/OS02/003Version No: 1.0

CONVERSION

SPOOL

JCLSYSIN

MVS

JES

PROCLIB

PROC

15Copyright © 2005, Infosys Technologies Ltd

ER/CORP/CRS/OS02/003Version No: 1.0

CONVERSION

JOB INTERPRETER - JES2

JES2ADDRESS

SPACE

INITIATORADDRESS

SPACE

PAYJCL

INTERPRETER

PAYCONTROLBLOCKS

16Copyright © 2005, Infosys Technologies Ltd

ER/CORP/CRS/OS02/003Version No: 1.0

CONVERSION

JOB INTERPRETER - JES3

JES3ADDRESS

SPACE

INITIATORADDRESS

SPACE

PAYJCL

INTERPRETER

PAYCONTROLBLOCKS

17Copyright © 2005, Infosys Technologies Ltd

ER/CORP/CRS/OS02/003Version No: 1.0

EXECUTION, OUTPUT, HARDCOPY and PURGE

• Execution:– JES selects a job for execution , based upon job CLASS and

job selection PRTY

Ex: //ER5077 JOB ,,PRTY=8,CLASS=A

– Allocation of datasets– SYSIN and SYSOUT

• OUTPUT, HARDCOPY and PURGE

18Copyright © 2005, Infosys Technologies Ltd

ER/CORP/CRS/OS02/003Version No: 1.0

JCL PROCESSING

JCL

SYSIN

SYSOUT

SPOOLJES2 /JES3

JES2 /JES3

INITIATOR1INITIATOR2

PRINTER

INPUTSTREAM

INITIATOR3

19Copyright © 2005, Infosys Technologies Ltd

ER/CORP/CRS/OS02/003Version No: 1.0

JCL execution

JCL INITIATION

STEP INITIATION

ALLOCATION

PROGRAM EXECUTION

STEP TERMINATION

JOB TERMINATION

JCL

SYSIN

SYSOUT

20Copyright © 2005, Infosys Technologies Ltd

ER/CORP/CRS/OS02/003Version No: 1.0

QUESTIONS ???

• JCL is used to write an application program ? Yes/No

•What are the different stages of JCL processing ?

21Copyright © 2005, Infosys Technologies Ltd

ER/CORP/CRS/OS02/003Version No: 1.0

JCL statements

• JOB - Job Identification

• EXEC - Instruction for Execution

• DD - Source of data to operate

22Copyright © 2005, Infosys Technologies Ltd

ER/CORP/CRS/OS02/003Version No: 1.0

JOB STATEMENT

ACCT CLASS

NAME NOTIFY

MSGLEVEL

TYPRUN MSGCLASS

PRTY COND

RESTART USER

REGION PASSWORD

PERFORM TIME

23Copyright © 2005, Infosys Technologies Ltd

ER/CORP/CRS/OS02/003Version No: 1.0

IMPORTANT JOB PARAMETERS Positional Parameters

a) Account Informationb) Name

EX: //ER5077J JOB A123,NAME1

All these parameters are optional as far as JCL is concerned, they are probably required by your installation.

24Copyright © 2005, Infosys Technologies Ltd

ER/CORP/CRS/OS02/003Version No: 1.0

IMPORTANT JOB PARAMETERS Keyword Parameters

EX: //ER5077J JOB ,,CLASS=A

• CLASS specifies the job class that is the nature of the job. Installation will specify which of the 36 possible classes to use which is from A to Z and 0 to 9 .

• Installation establishes a default class that is in effect if CLASS is omitted.

CLASS

25Copyright © 2005, Infosys Technologies Ltd

ER/CORP/CRS/OS02/003Version No: 1.0

A typical JOB Class assignment

Class Characteristics

A Execute within 15 min of submission

B Execute within 30 min of submission

C Execute within 60 min of submission

D Execute Overnight

H Will be held until released by operator

L Execute within 15 min of submission

T Requires Tape Processing

26Copyright © 2005, Infosys Technologies Ltd

ER/CORP/CRS/OS02/003Version No: 1.0

IMPORTANT JOB PARAMETERS Keyword Parameters

EX: //ER5077J JOB ,,MSGCLASS=A

• MSGCLASS specifies the job scheduler message output class.

• Job scheduler messages include all messages not printed by the job steps being executed but the JCL messages and system messages

• Installation establishes a default class that is in effect if MSGCLASS is omitted.

MSGCLASS

27Copyright © 2005, Infosys Technologies Ltd

ER/CORP/CRS/OS02/003Version No: 1.0

IMPORTANT JOB PARAMETERS Keyword Parameters

EX: //ER5077J JOB ,,MSGLEVEL=(1,1)

• MSGLEVEL(statements,messages) specifies the printing of JCL statements and allocation messages.

• EX: MSGLEVEL(0,1) will print only JOB statement, and all the allocation, JES, SMS and operator messages

• By default it is MSGLEVEL(1,1)

MSGLEVEL

28Copyright © 2005, Infosys Technologies Ltd

ER/CORP/CRS/OS02/003Version No: 1.0

IMPORTANT JOB PARAMETERS Keyword Parameters

//ER5077J JOB ,,NOTIFY=&SYSUID//ER5077J JOB ,,NOTIFY=ER5077

• Requests the system sends a message to the TSO user id specified when the job completes processing

NOTIFY

29Copyright © 2005, Infosys Technologies Ltd

ER/CORP/CRS/OS02/003Version No: 1.0

IMPORTANT JOB PARAMETERS Keyword Parameters

EX: //ER5077J JOB ,,TYPRUN=SCAN

• TYPRUN checks the JCL and holds the job in the input queue.

• TYPRUN = SCAN checks the JCL for syntax errors and suppresses execution of the job

• TYPRUN = HOLD holds the JCL in the input queue for later execution.It is held until the operator releases it.

• TYPRUN = JCLHOLD(JES2 only) similar to HOLD but the difference is it is checked while it is not with the HOLD option.

• TYPRUN = COPY(JES2 only) lists or duplicates the lines placed in the JOB statement to the class assigned in the MSGCLASS parameter and suppresses execution.

TYPRUN

30Copyright © 2005, Infosys Technologies Ltd

ER/CORP/CRS/OS02/003Version No: 1.0

SOME OTHER Keyword JOB PARAMETERS

PRTY=Priority : is related to the CLASS parameter. It assigns priority to jobs which belong to the same class.priority numbers range from (0-14) or (0-15) depending on installations.

TIME=(min,sec) : signifies how much CPU time the JOB can take to run.

RESTART=STEPNAME :Forces the JOB execution to start from a particular STEP.

31Copyright © 2005, Infosys Technologies Ltd

ER/CORP/CRS/OS02/003Version No: 1.0

SOME OTHER keyword JOB PARAMETERS

• REGION=96K :To override the default amount of workspace assigned for the job.

• COND=(4,LT) :Permits the execution of a steps to depend on the return code from the previous steps.

• ADDRSPC=REAL : It is used to specify whether the program is to use REAL or VIRTual ADDRess SPaCe. Default is Virtual. If Real is coded then the REGION parameter is also to be coded.

32Copyright © 2005, Infosys Technologies Ltd

ER/CORP/CRS/OS02/003Version No: 1.0

EXEC STATEMENTS

PGM COND

PROC PARM

ACCT REGION

ADDRSPC TIME

PERFORM

33Copyright © 2005, Infosys Technologies Ltd

ER/CORP/CRS/OS02/003Version No: 1.0

IMPORTANT EXEC PARAMETERS positional parameters

EX: //STEP1 EXEC PGM=IEFBR14

The PGM parameter identifies the name of the program that is to be executed.

EX: //STEP1 EXEC PROC=MYPROC

The PROC parameter identifies the name of the procedure that is to be called.

PGM & PROC

34Copyright © 2005, Infosys Technologies Ltd

ER/CORP/CRS/OS02/003Version No: 1.0

IMPORTANT EXEC PARAMETERS keyword parameters

EX: //STEP1 EXEC PGM=IEBUPDT,PARM=‘LET,MAP,XREF’

The PARM parameter is used to supply information to a program as it executes.

PARM

35Copyright © 2005, Infosys Technologies Ltd

ER/CORP/CRS/OS02/003Version No: 1.0

IMPORTANT EXEC PARAMETERS keyword parameters

EX: //STEP1 EXEC PGM=IEBUPDT,ADDRSPC=VIRT

The ADDRSPC parameter is to indicate to the system that the job step is to use either VIRT (virtual) or REAL (real) storage.

By default it is virtual.

ADDRSPC

36Copyright © 2005, Infosys Technologies Ltd

ER/CORP/CRS/OS02/003Version No: 1.0

IMPORTANT EXEC PARAMETERS keyword parameters

EX: //STEP3 EXEC PGM=IEBUPDT,COND=(8,LE,STEP1)

• The COND Permits the execution of steps to depend on the return code from the previous steps.

• The question should be is 8 less than the RC code of STEP1. If Yes then Bypass STEP3 If No Execute STEP3

• The COND parameter is also a JOB parameter.

COND

37Copyright © 2005, Infosys Technologies Ltd

ER/CORP/CRS/OS02/003Version No: 1.0

COND parameter in detail

Format :

COND=( 0/4/6/8/12/16 , GT/GE/LT/LE/EQ/NE , step name , EVEN/ONLY )

RC comparison code (0 - 4095)

Condition

EVEN : step will be executed even if previous steps terminate abnormally

ONLY : step will be executed only if previous stepsterminate abnormally.

Only code in the exec statementnot in job statement

38Copyright © 2005, Infosys Technologies Ltd

ER/CORP/CRS/OS02/003Version No: 1.0

COND parameter examples (in JOB statement)

//ER5077J JOB ,,COND=(4,LT)//STEP1 EXEC PGM=IEFBR14 //STEP2 EXEC PGM=IFBR14 //STEP3 EXEC PGM=IEFBR14

• STEP1 executes with RC = 0

• STEP2 executes with RC *S806 that is it is greater than 4

• Job terminates

39Copyright © 2005, Infosys Technologies Ltd

ER/CORP/CRS/OS02/003Version No: 1.0

COND parameter examples (in EXEC statement)

//ER5077J JOB ,,CLASS=A//STEP1 EXEC PGM=IEFBR14 //STEP2 EXEC PGM=IEFBR14,COND=(0,EQ,STEP1)

• STEP1 executes with RC = 0

• STEP2 does not execute

40Copyright © 2005, Infosys Technologies Ltd

ER/CORP/CRS/OS02/003Version No: 1.0

COND parameter examples (in EXEC statement)

// ER5077J JOB ,,CLASS=A//STEP1 EXEC PGM=IEFBR14 //STEP2 EXEC PGM=IEFBR14,COND=ONLY

• STEP1 executes with RC = 0

• STEP2 does not execute

//ER5077J JOB ,,CLASS=A//STEP1 EXEC PGM=IFBR14 //STEP2 EXEC PGM=IEFBR14 //STEP3 EXEC PGM=IEFBR14,COND=ONLY

• STEP1 abends with RC = *S806• STEP2 does not execute ( if a single step abends all other steps are bypassed if no COND statement is there )• STEP3 executes with RC = 0

41Copyright © 2005, Infosys Technologies Ltd

ER/CORP/CRS/OS02/003Version No: 1.0

COND parameter examples (in EXEC statement)

//ER5077J JOB ,,CLASS=A//STEP1 EXEC PGM=IEFBR14 //STEP2 EXEC PGM=IEFBR14,COND=EVEN

• STEP1 executes with RC = 0

• STEP2 executes with RC = 0

//ER5077J JOB ,,CLASS=A//STEP1 EXEC PGM=IFBR14 //STEP2 EXEC PGM=IEFBR14 //STEP3 EXEC PGM=IEFBR14,COND=EVEN

• STEP1 abends with RC = *S806

• STEP2 does not execute ( if a single step abends all other steps are bypassed if no COND statement is there )

• STEP3 executes with RC = 0

42Copyright © 2005, Infosys Technologies Ltd

ER/CORP/CRS/OS02/003Version No: 1.0

IMPORTANTEXECPARAMETERS keyword parameters (IF/THEN/ELSE/ENDIF)

EX: // IF STEPA.RC GE 4 THEN //jcl statements // ELSE //jcl statements // ENDIF

• The IF/THEN/ELSE/ENDIF statement construct provides a simple means of selectively executing job steps.

• It is available in Release 4 or later , of MVS/ESA and eliminates the need to struggle with the COND parameter.

43Copyright © 2005, Infosys Technologies Ltd

ER/CORP/CRS/OS02/003Version No: 1.0

IF/THEN/ELSE/ENDIF parameter examples

//ER5077A JOB 2933100P,ABC,MSGCLASS=A,CLASS=A//STEP1 EXEC PGM=IEFBR14 // IF STEP1.RC GT 0 THEN //STEP3 EXEC PGM=IEFBR14 //DD1 DD DSN=ER5077.TRUE.PS,DISP=(NEW,CATLG), // VOL=SER=INUSR2, // SPACE=(TRK,(1,1)), // DCB=(LRECL=80,BLKSIZE=800,RECFM=FB) // ELSE //STEP4 EXEC PGM=IEFBR14 //DD2 DD DSN=ER5077.FALSE.PS,DISP=(NEW,CATLG), // VOL=SER=INUSR2, // SPACE=(TRK,(1,1)), // DCB=(LRECL=80,BLKSIZE=800,RECFM=FB) // ENDIF /*

STEPNAME PROCSTEP RC STEP1 00 STEP3 FLUSH STEP4 00

44Copyright © 2005, Infosys Technologies Ltd

ER/CORP/CRS/OS02/003Version No: 1.0

COMMON keyword PARAMETERS in JOB & EXEC

TIME

REGION

PERFORM

COND

ADDRSPC

ACCT

45Copyright © 2005, Infosys Technologies Ltd

ER/CORP/CRS/OS02/003Version No: 1.0

JOB ENTRY SUBSYSTEM

JES2 / JES3

JES2 or JES3 statements can be

included to communicate with JES concerning...• INPUT• OUTPUT• PROCESSING

46Copyright © 2005, Infosys Technologies Ltd

ER/CORP/CRS/OS02/003Version No: 1.0

JES2 Control Statements

$COMMAND OUTPUT SIGNOFF

JOBPARAM PRIORITY SIGNON

MESSAGE ROUTE XEQ

NETACCT SETUP XMIT

NOTIFY

47Copyright © 2005, Infosys Technologies Ltd

ER/CORP/CRS/OS02/003Version No: 1.0

JES2 Control Statements

NOTIFY - direct job’s notification messages to a user.

PRIORITY or PRTY -Assign a selection priority for your job. Within a job class, a job with a higher priority is selected for execution sooner.

• JES2 Control statements are preceded with /* in col1 & col2.

48Copyright © 2005, Infosys Technologies Ltd

ER/CORP/CRS/OS02/003Version No: 1.0

Errors

•JCL syntax errors. JOB will not be submitted

• JCL allocation errors. JES2-subsequent steps will not get executed.

JES3-detects errors in the beginning.

49Copyright © 2005, Infosys Technologies Ltd

ER/CORP/CRS/OS02/003Version No: 1.0

Abend Failures

An ABEND failure occurs under the following conditions:

A program while executing, attempts to perform an instruction or operation which the system recognizes as being impossible or unacceptable.

50Copyright © 2005, Infosys Technologies Ltd

ER/CORP/CRS/OS02/003Version No: 1.0

Causes of Abend Failures

Logic error Resource unavailability Exceeding limits (Time or Space on DASD) Hardware Malfunction User ABENDS Operator intervention Operating System failure

51Copyright © 2005, Infosys Technologies Ltd

ER/CORP/CRS/OS02/003Version No: 1.0

Thank You!