Let's understand Mainframe
Home Tutorials Interview Q&A Quiz Mainframe Memes Contact us About us

Module 3: JCL EXEC Statement

EXEC Statement

A JOB may consist of multiple job steps. Role of each step is complete the required function. These functions are carried out by executing programs or procedure. This kind of information is coded using EXEC statement. The role of EXEC statement is to identify the program or procedure executed by each step in Job. EXEC statement is the first statement of each job step. A maximum 255 job steps can be coded within a single JCL

//STEPNAME EXEC PGM=program-name[,PARM=information]
  • STEPNAME:- it is name assigned to the job step
  • EXEC:- it is keyword, used to indicate that the statement is EXEC statement
  • PGM=program-name:- it is name of the program to be executed, this is a positional parameter
  • PARM=information:- This is optional parameter, specifies the information that is passed to the program

EXEC Statement – Example

  • An EXEC statement that executes program PAY5B10 in step PAYLIST
  • An EXEC statement that passes three parameters to program HEWL

Few more parameters of EXEC statement:

  • ADDRSPC:- Indicates to the system that the job step is to use either virtual or real storage
    • Syntax: ADDRSPC={REAL/VIRT}

  • REGION:- It is used to specify amount of virtual or real storage the step may use. It can be requested in the unit of kilobytes(value1K) or megabytes(value2M). If requested in form of kilobytes, then value1 should be multiple of 4 or the system will automatically round it to nearest 4K allocates for your job. Region parameter coded on JOB card overrides the parameter coded on EXEC card.
    • Region=0M allocate all the available memory in the address space to this job
    • Syntax:- REGION={value1K/value2M} (here, value1 can be 1-2096128 & value2 can be 1-2047)
    • Example:- //STEP1 EXEC PGM=PGM1,REGION=4M

  • TIME:- It is used to control the amount of time the step can use the CPU in minutes and/or seconds.
    • Syntax:- TIME=minutes[,seconds] (here, minutes <= 1440 & seconds <60)
    • TIME=NOLIMIT/1440/MAXIMUM means the job can use CPU for unlimited time
    • TIME=0 will produce unpredictable results
    • Example:- //STEP1 EXEC PGM=PGM1,TIME=120

  • COND:- It is used to test return codes from previous job steps to determine whether or not to bypass the current job step. If any of the conditions in COND is true, then the particular step is skipped. Maximum 8 condition can be specified.
    • Syntax:
    • If the step name is not given, then this check will happen for all the prior executed step
    • COND=ONLY will allow the step to execute only if the prior step is abended
    • COND=EVEN will allow step to execute the step irrespective of prior steps success or failure
    • COND Parameter examples:-
        Expanation:- STEP1 will be executed irrespective of prior steps success or failure
        Expanation:- STEP1 will be executed only if any of the prior step fails
      • //STEP1 EXEC PGM=PGM1, COND=(7,LT)
        Expanation:- STEP1 will be execute only when return code issued by prior step is not less than 7.
      • //STEP2 EXEC PGM=PGM2, COND=(8,EQ,STEP1)
        Expanation:- STEP2 will be bypassed if 8 is equal to return code issued by STEP1
      • //STEP3 EXEC PGM=PGM3,COND=((8,EQ,STEP1),(12,LE,STEP2))
        Expanation:- STEP3 will be bypassed if 8 is equal to return code issued by STEP1 and 12 is less than return code issued by STEP2

© copyright mainframebug.com
Privacy Policy