jcl slides day1

81
Introduction JOB CONTROL LANGUAGE

Upload: api-3838727

Post on 14-Nov-2014

169 views

Category:

Documents


17 download

TRANSCRIPT

Page 1: Jcl Slides Day1

Introduction

JOB CONTROL LANGUAGE

Page 2: Jcl Slides Day1

AGENDA FOR DAY 1

JCL Introduction

JOB Statement

JOB Parameters ( Positional and Keyword )

Page 3: Jcl Slides Day1

What is JCL ?.

Question

Page 4: Jcl Slides Day1

What is JCL ?.

JCL stands for JOB CONTROL LANGUAGE

Provides a Mechanism to communicate the requirements to execute a program, to the MVS operating system.

JCL consists of statements that provide specifications to execute a JOB

Page 5: Jcl Slides Day1

JOB CONTROL LANGUAGE (JCL)

JCL is a language which allows users to communicate with the operating system

JCL step tells the operating system

– Name, location of the application program to be processed

– Name and location of the data files needed by the application program

– Hardware devices needed by the application program

to achieve its function

Page 6: Jcl Slides Day1

Why we need JCL ?.

Question

Page 7: Jcl Slides Day1

Why we Need JCL ?.

Job control language will identify all the resources needed by the program to the MVS Operating system.

You need to have JCL , If you want to run your program in batch mode in a mainframe environment.

Control serious of JOB executed in Mainframe Environment

Page 8: Jcl Slides Day1

How JCL Works ?.

Question

Page 9: Jcl Slides Day1

HOW JCL WORKS ?.

Every JCL coded has to be run; In Mainframe terminology, it is

called submitting the JCL; henceforth known as submitting the JOB

There is a subsystem in MVS called JES (short for Job Entry

Subsystem) that manages JOBS submitted to the system by users

JES

Receives JOBS

Schedules JOBS based on their priority

Allocates resources to JOBS as they execute

Processes output generated by JOBS

Page 10: Jcl Slides Day1

JES RESP

Page 11: Jcl Slides Day1

Structure of JCL

Overview

Page 12: Jcl Slides Day1

JOB CONTROL LANGUAGE

Page 13: Jcl Slides Day1

JOB STMNT

Page 14: Jcl Slides Day1

EXEC STMT

Page 15: Jcl Slides Day1

DD STATEMENT

Page 16: Jcl Slides Day1

STRUCTURE OF JCL

oVERVIEW

Page 17: Jcl Slides Day1

General Format of JCL Statement

JCL Statements are coded as 80 bytes records and are categorized into following fields:

IDENTIFIER Field

NAME Field

OPERATION Field

PARAMETER Field

COMMENT Field

Page 18: Jcl Slides Day1

Basic Format for JCL Statement

//P390B21R JOB 3612,’RAJESH’,NOTIFY=P390B21//POST EXEC PGM=CM3000//CUSTRAN DD DSN=P390B21.CUSTOMER.TRANS,DSP=SHR//CUSTRAN DD DSN=P390B21.CUSTOMER.TRANS,DSP=SHR//ERRLST DD SYSOUT=*

Identifier

Name Field

Operation Field

Parameter Field

Page 19: Jcl Slides Day1

Question and Answers

Overview

Page 20: Jcl Slides Day1

JOB STATEMENT

Overview

Page 21: Jcl Slides Day1

What is JOB STATEMENT ?.

Question

Page 22: Jcl Slides Day1

CODING RULES FOR JOB STATEMENT

Overview

Page 23: Jcl Slides Day1

Coding Rules for of Job Statement

Page 24: Jcl Slides Day1

Example: Coding Rules for of Job Statement

Page 25: Jcl Slides Day1

Coding Rules for of Job Statement for Operation Field

Page 26: Jcl Slides Day1

Coding Rules for of Job Statement

Page 27: Jcl Slides Day1

JCL Field Definition Rules

PARAMETER fields follow OPERATION field and separated by commas

COMMENT field

Follows parameter field and can contain any details

Must be preceded by one blank

Can be entered in all lines

Page 28: Jcl Slides Day1

Coding Rule for Parameter Field

Page 29: Jcl Slides Day1

Coding Rules for Parameter Field

Page 30: Jcl Slides Day1

Parameter Fields

Parameter fields are of two types – Positional and Keyword Parameters

Positional Parameters

Should be coded in a specific sequence

Separated by commas

Omitted parameters indicated by a comma to indicate the positional nature

Keyword Parameters

No specific sequence and can be coded in any order

Format is parm=<value>

Separated by commas

Follow positional parameters

Can be omitted altogether if required

Page 31: Jcl Slides Day1

Position and Keyword Parameters

Page 32: Jcl Slides Day1

Coding Rules for Positional Parameter

Page 33: Jcl Slides Day1

Coding Rules for Keyword Parameter(1)

Page 34: Jcl Slides Day1

Coding Rules for Comment field

Page 35: Jcl Slides Day1

Coding Rules for Comment Field

Page 36: Jcl Slides Day1

JOB statement identifies the JOB to the system

JOB Statement consists of

JOBNAME

JOB operator

Positional Parameters

Accounting Info

Programmer NAME

Keyword Parameters

MSGCLASS

CLASS

MSGLEVEL

NOTIFY

REGION

TIME

PRTY

COND

RESTART

TYPRUN

JOB STATEMENT

Page 37: Jcl Slides Day1

JOB NAME

Starts in column 3

following the identifier

field

Should be between 1 to

8 characters

First character should be

Alphabetic and not a

Number

Should be followed by a

space

Page 38: Jcl Slides Day1

JOB Operator

Preceded and succeeded by a blank space

Page 39: Jcl Slides Day1

Positional Parameters

JOB statement consists of two positional parameters

Job Accounting Information

Programmer name

Page 40: Jcl Slides Day1

Accounting Information

Identifies the Account number to the system to track the CPU time used by the JOB

Has two positional sub parameters – Account number and Additional Accounting info

Format is (<account-number>, <additional-accounting-info>)

Format is installation dependent

Within accounting info, If only <account-number> is

specified, then parantheses can be omitted

If only <additional-accounting-info> is specified, then the absence of <account-number> is specified by a comma to indicate the positional nature of the sub parameters

JCL

MVS

JES

CPU

ACCOUNT

ACCT#, CPU Time

BILL

Account 1

Account 2

Page 41: Jcl Slides Day1

Accounting Information - Examples

Page 42: Jcl Slides Day1

KEYWORD PARAMETERS

Overview

Page 43: Jcl Slides Day1

Keyword Parameters

Keyword parameters follow positional parameters and can be in any order

Some of the keyword parameters used in the JOB statement are

CLASS

NOTIFY

PRTY

REGION

TIME

TYPRUN

MSGCLASS

MSGLEVEL

COND

RESTART

Page 44: Jcl Slides Day1

CLASS PARAMETER

Is an optional keyword parameter

Specifies the type of JOB submitted to the system

Some JOBS are CPU intensive, while others are more Input-Output oriented; JOB characteristics like these are identified to the system by the CLASS parameter

Format is CLASS=<class> where <class> is a character between A to Z or 0 to 9

Installations will have a default class assigned to the CLASS parameter

Programmers to check with system administrator about list of classes defined in the system

CLASS A

CLASS B

CLASS Q

OS

JESCPU1

CPU 2

CPU 3

J1

J2

J3

SPOOL

J1 & J2 Processed

CLASS A & B

J3 Processed

CLASS Q

Page 45: Jcl Slides Day1

CLASS Parameter in JOB Statement

Page 46: Jcl Slides Day1

NOTIFY PARAMETER

Specifies the user to whom JOB is to be submitted after completion

Can specify the user ID or the parameter (&SYSUID)

Page 47: Jcl Slides Day1
Page 48: Jcl Slides Day1

PRTY PARAMETER

PRTY

Specifies priority for scheduling JOBS within a CLASS

Permitted value ranges from 0 to 14 or 0 to 15 depending on JES2

Page 49: Jcl Slides Day1

PRTY PARAMETER

Page 50: Jcl Slides Day1

MSGCLASS PARAMETER

Is an optional keyword parameter

Specifies the specific output device to which the messages are to be routed after completion of the JOB

Format is MSGCLASS=<classname> where <classname> is a character between A to Z or 0 to 9

Assigns JOB log to a particular sysout CLASS

Installations will have a default class assigned to the MSGCLASS parameter

Programmers to check with system administrator about list of message classes defined in the system

Page 51: Jcl Slides Day1

MSGLEVEL PARAMETER

Is an optional Keyword parameter

Controls the level of listing of the JCL output of the JOB

Formats available are

MSGLEVEL=(<statements>, <messages>)

MSGLEVEL=statements

MSGLEVEL=(, <messages>)

Permitted values for statements are

0 for listing only JOB statement

1 for listing all JCL statements including procedures

2 for listing only input statements

Permitted values for messages are

0 for not listing any allocation messages

1 for listing all allocation messages

Preferred option is MSGLEVEL=(1,1)

Page 52: Jcl Slides Day1

MSGLEVEL=(0,0)

Page 53: Jcl Slides Day1

MSGLEVEL=(0,0)

JESJCL: Shows only JOB

statement details

JESYSMSG: Shows no

allocation message

details; Shows only

Start and Stop times

Page 54: Jcl Slides Day1

JESJCL: Shows only JOB

statement details

JESYSMSG: Shows all allocation messages

MSGLEVEL=(0,1)

Page 55: Jcl Slides Day1

JESJCL: Shows all JCL

statements

JESYSMSG: Shows no

allocation message

details; Shows only

Start and Stop times

MSGLEVEL=(1,0)

Page 56: Jcl Slides Day1

MSGLEVEL=(1,1)

JESJCL: Shows all JCL statements

JESYSMSG: Shows all allocation message

Page 57: Jcl Slides Day1

MSGLEVEL=(2,0)

JESJCL: Shows all JCL statements without substitutions

JESYSMSG: Shows no allocation message details; Shows only Start and Stop times

Page 58: Jcl Slides Day1

MSGLEVEL=(2,1)

JESJCL: Shows all JCL statements without substitutions

JESYSMSG: Shows all allocation message

Page 59: Jcl Slides Day1

COND Parameter

Overview

Page 60: Jcl Slides Day1
Page 61: Jcl Slides Day1

COND PARAMETER

Specifies whether the JOB should continue or terminate depending on the outcome of any step in the JOB

Before each step is executed, the system checks the COND parameter against the return code from completed JOB step

If satisfied, the system terminates the JOB, else it executes the JOB

Format is COND=((code, operator), (code, operator)…)

Page 62: Jcl Slides Day1

Interpretation of Condition Codes

COND parameter check Return code from completed step

Terminate JOB Execute JOB

COND=(code,GT) RC < code RC > = code

COND=(code,GE) RC <= code RC > code

COND=(code,EQ) RC = code RC not = code

COND=(code,LT) RC > code RC < = code

COND=(code,LE) RC >= code RC < code

COND=(code,NE) RC not = code RC = code

Page 63: Jcl Slides Day1
Page 64: Jcl Slides Day1

In this visual, condition code set at JOB level is COND=(4,LT) which interprets that if the Return Code from any step is greater than 4, bypass the remaining steps in the JOB

Program

RTCODE04 if executed returns a RC of 4

RTCODE08 if executed returns a RC of 8

RTCODE16 if executed returns a RC of 16

In the executed JOB STEP3 is bypassed as the Return Code from STEP2 is 8 which is greater than 4

COND PARAMETER

Page 65: Jcl Slides Day1

Visual shows part of the

JOBLOG of JOB executed

with COND=(4,LT)

JOBLOB shows the JOB

terminated with STEP2

COND PARAMETER

Page 66: Jcl Slides Day1

In the visual, condition code set at JOB level is COND=(8,GE) which interprets that if the RC from any step is less than or equal to 8, bypass the remaining steps in the JOB

Program RTCODE16 in STEP1 if

executed, returns a RC of 16

RTCODE00 in STEP2 if executed, returns a RC of 0

RTCODE04 if executed returns a RC of 4

Result is STEP3 is bypassed as the RC from STEP2 is 0 which is less than 8

COND PARAMETER

Page 67: Jcl Slides Day1

Visual shows part of the

JOBLOG of JOB executed

with COND=(8,GE)

JOBLOG shows the JOB

terminated with STEP2

COND PARAMETER

Page 68: Jcl Slides Day1

REGION PARAMETER

Specifies the amount the workspace required by the operating system to execute the JOB

Value specified will apply to each step

Formats are:

REGION=<value>K

REGION=<value>M

REGION parameter should only be in units of “K” or “M” indicating Kilobytes or Megabytes of workspace requested; Results in JCL error if unit is not specified

If omitted, a default value is assigned by the system

If REGION=0M is specified, the system takes the most optimum space

Page 69: Jcl Slides Day1

Region

Page 70: Jcl Slides Day1

Region

Page 71: Jcl Slides Day1

Region

Page 72: Jcl Slides Day1

ADDRSPC PARAMETER

Page 73: Jcl Slides Day1

ADDRSPC Parameter

Page 74: Jcl Slides Day1

ADDRSPC SDSF Output

Page 75: Jcl Slides Day1

ADDRSPC SDSF Output

Page 76: Jcl Slides Day1

PAGES Parameter

Page 77: Jcl Slides Day1

TIME PARAMETER

Specifies the maximum CPU execution time permitted for the JOB

If actual CPU execution time exceeds value specified in the TIME parameter, JOB will fail with S322 abend

Formats are

TIME=(minutes, seconds)

TIME=minutes

TIME=(,seconds)

TIME=1440

TIME=NOLIMIT

Seconds can be in the range from 0 to fifty nine

Page 78: Jcl Slides Day1

TIME Parameter

Page 79: Jcl Slides Day1

TYPRUN PARAMETER

TYPRUN is used for special JOB processing

Formats are

TYPRUN=HOLD

TYPRUN=SCAN

TYPRUN=HOLD causes the JOB to be held in the input queue till released by an operator

TYPRUN=SCAN causes the JCL to be scanned for syntax errors and reports the errors. The JOB is not executed when this option is used

Page 80: Jcl Slides Day1

RESTART PARAMETER

Is an optional keyword parameter

Instructs the JOB to restart execution from a specific step, instead of from beginning of the JOB

Formats are

RESTART=<stepname>

RESTART=<stepname.procstepname>

Page 81: Jcl Slides Day1

END