📜  JCL-EXEC语句

📅  最后修改于: 2020-11-22 17:02:00             🧑  作者: Mango


每个JCL可以由许多工作步骤组成。每个作业步骤都可以直接执行程序,也可以调用一个过程,该过程又执行一个或多个程序(作业步骤)。包含作业步骤程序/过程信息的语句EXEC语句。

EXEC语句的目的是为作业步骤中执行的程序/过程提供所需的信息。如果EXEC语句调用过程而不是直接执行程序,则此语句中编码的参数可以将数据传递给正在执行的程序,可以覆盖JOB语句的某些参数,并且可以将参数传递给过程。

句法

以下是JCL EXEC语句的基本语法:

//Step-name EXEC Positional-param, Keyword-param 

描述

让我们看一下上面的EXEC语句语法中使用的术语的描述。

步骤名称

这标识了JCL中的作业步骤。它的长度可以是1到8,带有字母数字字符。

执行

这是将其标识为EXEC语句的关键字。

位置参数

这些是位置参数,可以有两种类型:

Positional Parameter Description
PGM This refers to the program name to be executed in the job step.
PROC This refers to the procedure name to be executed in the job step. We will discuss it a separate chapter.

关键字参数

以下是EXEC语句的各种关键字参数。您可以根据需求使用一个或多个参数,它们之间用逗号分隔:

Keyword Parameter Description
PARM

Used to provide parametrized data to the program that is being executed in the job step. This is a program dependant field and do not have definite rules, except that the PARM value has to be included within quotation in the event of having special characters.

For example given below, the value “CUST1000” is passed as an alphanumeric value to the program. If the program is in COBOL, the value passed through a PARM parameter in a JCL is received in the LINKAGE SECTION of the program.

ADDRSPC

This is used to specify whether the job step require virtual or real storage for execution. Virtual storage is pageable whereas real storage is not and is placed in the main memory for execution. Job steps, which require faster execution can be placed in real storage. Following is the syntax:

ADDRSPC=VIRT | REAL

When an ADDRSPC is not coded, VIRT is the default one.

ACCT

This specifies the accounting information of the job step. Following is the syntax:

ACCT=(userid)

This is similar to the positional parameter accounting information in the JOB statement. If it is coded both in JOB and EXEC statement, then the accounting information in JOB statement applies to all job steps where an ACCT parameter is not coded. The ACCT parameter in an EXEC statement will override the one present in the JOB statement for that job step only.

EXEC和JOB语句的常用关键字参数

Keyword Parameter Description
ADDRSPC ADDRSPC coded in JOB statement overrides the ADDRSPC coded in EXEC statement of any job step.
TIME If TIME is coded in an EXEC statement, then it applies to that job step only. If it is specified in both JOB and EXEC statement, then both will be in effect and can cause time-out error due to either of it. It is not recommended to use TIME parameter in both the JOB and EXEC statement together.
REGION

If REGION is coded in an EXEC statement, then it applies to that job step only.

REGION coded in JOB statement overrides the REGION coded in EXEC statement of any job step.

COND

Used to control the job step execution based on the return-code of the previous step.

If a COND parameter is coded in an EXEC statement of a job step, then the COND parameter of the JOB statement (if present) is ignored. The various tests that can be performed using a COND parameter is explained in conditional Processing.

以下是JCL脚本以及JOB和EXEC语句的简单示例:

//TTYYSAMP JOB 'TUTO',CLASS=6,MSGCLASS=X,REGION=8K,
//      NOTIFY=&SYSUID
//*
//STEP010 EXEC PGM=MYCOBOL,PARAM=CUST1000,
//      ACCT=(XXXX),REGION=8K,ADDRSPC=REAL,TIME=1440