80
EXEC STATEMENT Overview

Jcl Slides Day2

Embed Size (px)

Citation preview

Page 1: Jcl Slides Day2

EXEC STATEMENT

Overview

Page 2: Jcl Slides Day2

EXEC STATEMENT

EXEC statement defines the beginning of a step in a job or a procedure.

An EXEC statement is required for each job step.

Maximum of 255 steps (EXEC statements) in a single job.

Stepnames follow the same rules for all names in JCL:

1-8 characters in length (alphanumeric or national(#,@,$)).

First character must be alphabetic or national.

Must be followed by at least one blank.

Page 3: Jcl Slides Day2

EXEC STATEMENT SYNTAX

Page 4: Jcl Slides Day2

PROGRAM EXECUTION

By default, SYS1.LINKLIB is searched for the program to be executed.

Page 5: Jcl Slides Day2

TIME PARAMETER

Page 6: Jcl Slides Day2

TIME-EXAMPLE

Page 7: Jcl Slides Day2
Page 8: Jcl Slides Day2

REGION Parameter

Specifies amount of

storage space required to

execute the step

Formats are:

REGION=<value>K

REGION=<value>M

<value> should be a

positive numeric in units of

“K” or “M” indicating

Kilobytes or Megabytes of

space

If omitted, a default value

is assigned by the system

Page 9: Jcl Slides Day2

COND Parameter

On completion of each step, a return-code is generated. This return-code can be checked and based on this a step can be bypassed or executed. This is done using the COND parameter

Formats are: COND=(<return-code>, <condition operator>) COND=(<return-code>, <condition operator>,

<stepname>) COND=EVEN COND=ONLY

<return-code> is a positive number from 0 to 4095

<condition operator> specifies the type of comparison to be made with the return-code of a previous step and can be one of GT,LT,GE,LE,EQ,NE

<stepname> is the name of a prior executed step

Page 10: Jcl Slides Day2

COND Parameter

In the visual, examine the condition codes set in STEP2 and STEP3

The interpretation of the Condition codes set are

In STEP2, if the RC from STEP1 is less than or equal to 8, STEP2 is executed

In STEP3, if the RC from STEP2 is equal to 4, STEP3 is bypassed

Program

RTCODE00 in STEP1, if executed, returns a RC of 0

RTCODE04 in STEP2, if executed, returns a RC of 4

RTCODE08 in STEP3, if executed, returns a RC of 8

Result is,STEP3 is bypassed as the RC from STEP2 is 4

Page 11: Jcl Slides Day2

COND Parameter - Interpretation

COND parameter check Return code from referred step

Terminate JOB Execute JOB

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

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

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

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

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

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

Page 12: Jcl Slides Day2

Example: Condition Parameter

Page 13: Jcl Slides Day2
Page 14: Jcl Slides Day2
Page 15: Jcl Slides Day2
Page 16: Jcl Slides Day2
Page 17: Jcl Slides Day2

EVEN and ONLY Condition Codes

COND=EVEN executes the step, even if any preceding

steps have ended abnormally

COND=ONLY executes the step, only if any preceding

steps have ended abnormally

Page 18: Jcl Slides Day2

Example: Condition Parameter for EVEN AND ONLY

Page 19: Jcl Slides Day2
Page 20: Jcl Slides Day2
Page 21: Jcl Slides Day2
Page 22: Jcl Slides Day2
Page 23: Jcl Slides Day2
Page 24: Jcl Slides Day2

DD STATEMENT

OVERVIEW

Page 25: Jcl Slides Day2

DD STATEMENT

The DD statement is used to describe a data set and specify the input and output resources needed for the data set.

A DD statement is normally required for each data set that is to be processed in a step.

All DD statements for a single step must follow the EXEC statement.

DD statements for a single step can usually be in any order.

Page 26: Jcl Slides Day2

Why DD ?.

Page 27: Jcl Slides Day2

Accessing a Data set

Page 28: Jcl Slides Day2

DD Statement

DD statement identifies a data stream to a program

DD statement contains

An optional DD name

DD operation field

Positional parameters

Keyword parameters

UNIT

DISP

Page 29: Jcl Slides Day2

DDNAME

Specifies a name for the DD statement

Must start with an alphabet and between 1 to 8 alphanumeric characters

Must begin in column 3 and be continued till column 10

Is conditionally optional

Page 30: Jcl Slides Day2

DSN - Keyword Parameter

Specifies the fully qualified physical name of the input or output file

Format is

DD DSN=<dataset-name> for a cataloged dataset

DD DSN=&&temporary-dataset-name for a temporary

dataset

For cataloged dataset, DSN name must be a maximum of 44

character including periods after every 8 characters or less

Temporary datasets start with && and are 1 to 6 characters long

Page 31: Jcl Slides Day2

Example for Creating Temporary Dataset

Page 32: Jcl Slides Day2
Page 33: Jcl Slides Day2
Page 34: Jcl Slides Day2

DISP Keyword Parameter

Specifies the existing status (disposition) of the dataset and steps to be taken on successful/unsuccessful execution of the step

Format is

DISP=(<present-status>, <normal-end-status>, <abnormal-end-status>)

present-status specifies current status, meaning whether the data set exists or is to be created and if it exists, the mode of access to it

normal-end-status specifies how to handle the dataset upon successful completion of the JOB

abnormal-end-status specifies how to handle the dataset upon abnormal termination of JOB

Default values are DISP=(NEW,DELETE,DELETE) for new dataset and DISP=(OLD,KEEP,KEEP) for existing dataset

Page 35: Jcl Slides Day2

DISP Keyword Parameter

DISP=(<present-status>, <normal-end-status>, <abnormal-end-status>)

One or more sub parameters can be omitted but at least one should

be coded

Sub parameters are positional in nature

If only <present-status> is coded, parantheses can be omitted

If the <present-status> field is omitted and the <normal-end-

status> and <abnormal-end-status> are coded, then parantheses

are required and comma should be coded before the sub-parameters

Page 36: Jcl Slides Day2

Example Program : DISP(NEW,DELETE,DELETE)

Page 37: Jcl Slides Day2
Page 38: Jcl Slides Day2
Page 39: Jcl Slides Day2

Example Program : DISP(NEW,KEEP,DELETE)

EXAMPLE

Page 40: Jcl Slides Day2
Page 41: Jcl Slides Day2
Page 42: Jcl Slides Day2

Example Program : DISP(NEW,PASS,DELETE)

Page 43: Jcl Slides Day2
Page 44: Jcl Slides Day2

DATA SET WILL NOT BE RETAINED

Page 45: Jcl Slides Day2

Example FOR COPYING A Physical file to another Physical File : DISP(NEW,CATLG,DELETE)

Example

Page 46: Jcl Slides Day2
Page 47: Jcl Slides Day2
Page 48: Jcl Slides Day2
Page 49: Jcl Slides Day2
Page 50: Jcl Slides Day2
Page 51: Jcl Slides Day2

Example Program : DISP(OLD,KEEP,DELETE)

Page 52: Jcl Slides Day2
Page 53: Jcl Slides Day2
Page 54: Jcl Slides Day2
Page 55: Jcl Slides Day2
Page 56: Jcl Slides Day2

DATASET WILL BE RE-WRITTEN

Page 57: Jcl Slides Day2

Example Program : DISP(MOD,KEEP,DELETE)

Page 58: Jcl Slides Day2

Example Program: DISP(MOD,KEEP,DELETE)

Page 59: Jcl Slides Day2
Page 60: Jcl Slides Day2
Page 61: Jcl Slides Day2
Page 62: Jcl Slides Day2
Page 63: Jcl Slides Day2
Page 64: Jcl Slides Day2

UNIT Keyword Parameter

Specifies information about the input or output devices used by

the JOB

Some formats are:

UNIT=device-address

UNIT=device-type

UNIT=device-group-name

Page 65: Jcl Slides Day2

SPACE Keyword Parameter

Page 66: Jcl Slides Day2

SPACE Keyword Parameter

Specifies Space required to allocate a new dataset on DASD

Format is SPACE=(S1,(S2,S3,S4),S5,S6,S7) where

S1 is mandatory and specifies unit of allocation

S2 is mandatory and specifies the primary quantity

S3 is optional and specifies the secondary quantity

S4 is optional and specifies the directory blocks used for creating a

partitioned dataset

S5 is optional and is coded as RLSE

S6 is optional and is coded as CONTIG

S7 is optional and is coded as ROUND

Page 67: Jcl Slides Day2

SPACE Keyword Parameter

SPACE=(S1,(S2,S3,S4),S5,S6,S7)

<S1> sub parameter specifies unit of allocation. The units are:

TRK – For allocating Space in units of tracks

CYL – For allocating Space in units of cylinders

<block-size> for allocating space in units of blocks; Exactly, how many

bytes of data will be allocated depends on the value specified in the

DCB=BLKSIZE sub parameter

Page 68: Jcl Slides Day2

SPACE Keyword Parameter

SPACE=(S1,(S2,S3,S4),S5,S6,S7)

<S2> sub parameter specifies primary quantity of space requested

<S3> sub parameter

Specifies secondary quantity of space which is allocated when primary quantity of space is insufficient

Secondary space when allocated may not be contiguous with primary space

If not specified JOB may abend

<S4> sub parameter

Specifies the number of directory blocks for creating a Partitioned dataset

Page 69: Jcl Slides Day2

SPACE Keyword Parameter

SPACE=(S1,(S2,S3,S4),S5,S6,S7)

<S5> sub parameter –

Specifies the option RLSE that indicates that any unused space allocated to a dataset be released once the dataset is closed.

Takes time to release space

<S6> sub-parameter

Specifies a value CONTIG that indicates that only contiguous space should be allocated to the dataset

Option applies only to primary space allocation

Results in decreased dataset access time

JOB abends if requested space is not contiguously available

<S7> sub parameter

Specifies a value ROUND

Page 70: Jcl Slides Day2

DATA CONTROL BLOCK Parameter - DCB

Specifies the attributes of the dataset

Sub parameters are:

RECFM

LRECL

BLKSIZE

DSORG

Page 71: Jcl Slides Day2

DCB - Sub Parameters

LRECL (Stands for Logical Record Length)

Format is LRECL=<record-length>

Specifies record length in bytes for fixed and variable length records

For variable record lengths, the LRECL should be 4 bytes more than the length of the largest record

BLKSIZE

Format is BLKSIZE=<block-size>

Specifies the block size of data in bytes

Must be a multiple of LRECL

For variable record lengths the BLKSIZE should be 4 bytes more than the length of the largest record

Page 72: Jcl Slides Day2

DCB – Sub Parameters

RECFM – Specifies record format of dataset being created

Format is RECFM=<record-format> where <record-format>

can take one of the following values

F - Fixed

FB - Fixed Blocked

V - Variable

VB - Variable Blocked

U - Undefined

Page 73: Jcl Slides Day2

DCB – Sub Parameters

DSORG specifies the way data set is organized

Format is DSORG=<dataset-organization> where <dataset-

organization> can take one of following values:

PS for Physical sequential

PO for Partitioned organization

Page 74: Jcl Slides Day2

Dataset Concatenation

Datasets can be concatenated and considered as one file by the system

All datasets being concatenated must have the same record format

All datasets being concatenated must exist on same type of device

To concatenate datasets omit the DDname from all the DD statements except the first one

In this visual FILE1 is a concatenated input dataset

Page 75: Jcl Slides Day2

Special DD statements

SYSIN

JOBLIB

STEPLIB

JCLLIB

SYSOUT

SYSDUMP

SYSABEND

Page 76: Jcl Slides Day2

JOBLIB

If coded, specifies the library where the load module of the program to be executed will be searched first in any step

Coded immediately after the JOB statement else results in JCL error

Page 77: Jcl Slides Day2

STEPLIB

Specifies the library

where the load module

of the program to be

executed will be

searched

Applies only to the

step where it is

specified

Page 78: Jcl Slides Day2

SYSOUT

Special DDname used for listing messages listed out of the DISPLAY verb used in COBOL program

Page 79: Jcl Slides Day2

Dump related special DDnames

SYSDUMP

Format is SYSDUMP DD ……

Used to obtain a dump of the contents of various registers and variables in case of an abnormal end of program

Dump is in hexadecimal format

SYSABEND

Format is SYSABEND DD ….

Contains same details as SYSDUMP with more details

SYSUDUMP

SYSMDUMP

Page 80: Jcl Slides Day2

END