JCL EXEC Statement

JCL - USER JCL - EXEC ACCT

Advertisements


Before proceding with EXEC statement, Refer the JCL Coding sheet topic.


EXEC statement used to identify the program or procedure (catalogue or instream) to execute at the specific job step.

EXEC statement also informs the system how to process the job step.

EXEC statements have details of the program/procedure to be executed.

EXEC keyword should start at 12th column and should end at 15th column.

EXEC statement is required for each job step.

EXEC statement treats as a beginning of the step in JCL or procedure.

JCL contains maximum 255 steps.

Job step is a combination of multiple JCL statements which are starts with //.

Step can be ended with null statement (‘//’) or starting of another step.


Syntax:

//[stepname]  EXEC  positional-parm[,keyword-parm]..[,symbolic-parm=value]..[comments]

EXEC statement can be divided into the below parts.


  1. Step name
  2. Operation
  3. Parameters
  4. Comment

Step name:


Step name is optional.

If the step name is needed, then step name must be unique in the entire job.

Step name must be unique among the procedures which are called by the same job.

If the step names are not unique and submitted the job, then the results might be unpredictable.


Rules:

Step name should be starts from 3rd column.

Step name is 1 through 8 characters.

Step name is a combination of alphanumeric and national characters (@,# and $).

Step name first character should be alphabetic or national character.

Step name must be followed by one blank before EXEC.


Operation:


Operation field describes about the type of operand.

Operation field consists of EXEC characters.

Operation field is of length 4 characters.

Operation field can start in any column.

Operation field is mandatory with every step name.

Operation field must be followed by one blank.


Parameters:


EXEC statement has three types of parameters.


  • Positional parameters
  • Keyword parameters
  • Symbolic parameters

Positional parameter (positional-parm):

EXEC statement must contain positional parameters.

The EXEC statement may contain one or more positional parameters.

Positional parameter must start after EXEC statement and before keyword parameters.

Positional parameters can start in any column.

Positional parameters are optional even though operation field is specified.

EXEC statement has two positional parameters.


Positional ParameterPurpose
PGMSpecifies program name system is to execute
PROCSpecifies procedure name system is to execute

Keyword parameters (keyword-parm):

EXEC statement can be coded with keyword parameters.

The keyword parameters are from the JOB statement.

The EXEC statement can contain one or more keyword parameters with it.

EXEC statement keyword parameters are less in count when compared with job statement keyword parameters.

Below keyword parameters are used with EXEC statement.


Keyword ParameterPurpose
ACCTSpecifies accounting information
ADDRSPCSpecifies the type of the storage required for the step
CONDSpecifies the return code tests used to determine the specific step execution
MEMLIMITSpecifies the limit on total number of usable virtual pages above the bar
RDSpecifies the user authority for automatic restart
REGIONSpecifies the Maximum amount of space required by the step
TIMESpecifies the Maximum amount of processor time the step can use

The below are the list of keyword parameter which are not part of JOB statement and only applicable for EXEC statement.


Keyword ParameterPurpose
DYNAMNBRHolds the number of dataset allocations for reuse
PARMUsed to pass the input data to the program

If EXEC statement executes any instream or cataloged procedure, all the keyword parameters in the instream or catalogued procedure will be overridden by the values of keyword parameters coded with EXEC statement.

If only one keyword parameter at a particular step in the in-stream or cataloged procedure needs to be overridden by the EXEC statement keyword parameter, then code like below.


Keyword. Proc-step-name=value

Example:

//STEP1  EXEC  PROC=MTHPROC, REGION.PROCSTP2=10K

The REGION 10K applies to the only step PROCSTP2 in the procedure MTHPROC.


Symbolic parameters (symbolic-parm=value):

EXEC statement can code with symbolic parameters.

EXEC statement can assign values to, or nullify, symbolic parameters.


Comment:


Comment used to make a note of current statement.

Comment field follows parameter field.

Comment field should be preceded with a blank after the parameter field.


Example 1:

//STEP1  EXEC PGM=SAMPLE,PARM='mainframestechhelp'

The EXEC statement named STEP1 invokes a program named SAMPLE and passes the value in the PARM parameter to SAMPLE.


Example 2:

//       EXEC PGM=SAMPLE,REGION=2K

This EXEC statement without a step name invokes a program named SAMPLE and specifies the maximum space for execution of the step.


Example 3:

//STEP1    EXEC PROC=MTHPROC,RD.STEP2=RNC

The EXEC statement named STEP1 invokes a procedure named STEP1. RD parameter overrides/applies to only the step named STEP2.


JCL - USER JCL - EXEC ACCT

Advertisements