Upload
api-3838727
View
157
Download
8
Embed Size (px)
Citation preview
EXEC STATEMENT
Overview
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.
EXEC STATEMENT SYNTAX
PROGRAM EXECUTION
By default, SYS1.LINKLIB is searched for the program to be executed.
TIME PARAMETER
TIME-EXAMPLE
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
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
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
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
Example: Condition Parameter
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
Example: Condition Parameter for EVEN AND ONLY
DD STATEMENT
OVERVIEW
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.
Why DD ?.
Accessing a Data set
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
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
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
Example for Creating Temporary Dataset
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
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
Example Program : DISP(NEW,DELETE,DELETE)
Example Program : DISP(NEW,KEEP,DELETE)
EXAMPLE
Example Program : DISP(NEW,PASS,DELETE)
DATA SET WILL NOT BE RETAINED
Example FOR COPYING A Physical file to another Physical File : DISP(NEW,CATLG,DELETE)
Example
Example Program : DISP(OLD,KEEP,DELETE)
DATASET WILL BE RE-WRITTEN
Example Program : DISP(MOD,KEEP,DELETE)
Example Program: DISP(MOD,KEEP,DELETE)
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
SPACE Keyword Parameter
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
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
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
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
DATA CONTROL BLOCK Parameter - DCB
Specifies the attributes of the dataset
Sub parameters are:
RECFM
LRECL
BLKSIZE
DSORG
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
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
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
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
Special DD statements
SYSIN
JOBLIB
STEPLIB
JCLLIB
SYSOUT
SYSDUMP
SYSABEND
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
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
SYSOUT
Special DDname used for listing messages listed out of the DISPLAY verb used in COBOL program
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
END