数据集名称 JCL 中的符号参数

发布于 2025-01-07 12:42:11 字数 235 浏览 1 评论 0原文

在 JCL 中,通常使用 & 创建符号参数。 (与符号)后跟变量名称。

但在数据集名称中,变量名称后面必须跟有点号。 例:

//J&USER JOB 1
//MYSTEP EXEC PGM=MYPROG
//MYDATA DD DSN=&USER..MYCLASS.COOL

为什么会这样呢?我怕以后不一致,所以才问这个问题。提前感谢您的任何帮助。

In JCL, normally Symbolic parameters is created using & (Ampersand sign) followed by the variable name.

But in dataset name, It has to followed by the dot sign after the variable name.
Example:

//J&USER JOB 1
//MYSTEP EXEC PGM=MYPROG
//MYDATA DD DSN=&USER..MYCLASS.COOL

Why is that so? I am afraid of inconsistency later, so I ask this question. Thanks for any helps in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

小伙你站住 2025-01-14 12:42:11

正如符号参数的开头由与号 (&) 标记一样。它可能会被终止
一个空格或一个句点。当以句点终止时,句点不是名称的一部分(就像开头部分一样)
& 符号不是)。

当整个字符串被符号参数替换时,它只是按原样编码:

  // SET MYPROG=FRED
  //RUNIT EXEC PGM=&MYPROG

这里 &MYPROG 被替换为它的值,FRED。弄清楚符号名称的开始或结束位置没有问题。
现在假设您要运行 3 个程序:FRED1FRED2FRED3。您可以执行以下操作:

  //RUN3 EXEC PGM=&MYPROG.3

这里,程序 FRED3 正在运行。符号 MYPROG 以句点结尾,相当于 FRED,对此
添加其余文本,生成 FRED3

在数据集名称中使用符号参数时,同样的情况也适用。需要第一个周期来终止
符号名称,下一个句点是数据集名称本身的一部分。例如,如果符号 USER 的计算结果为
ABC123,然后

  //MYDSN DD DSN=&USER..MYDATA

计算结果为 ABC123.MYDATA 作为数据集名称。同样,

  //MYDSN DD DSN=&USER.X.MYDATA

计算结果为:ABC123X.MYDATA 请注意,生成的 DSN 有一个句点,因为第一个句点
终止符号名称并且不是结果的一部分。

Just as the beginning of a symbolic parameter is marked by an ampersand (&). It may be terminated by
a space or a period. When terminated by a period, the period is not part of the name (just as the opening
ampersand isn't).

When an entire string is replaced by a symbolic parameter it is just coded as is:

  // SET MYPROG=FRED
  //RUNIT EXEC PGM=&MYPROG

Here &MYPROG is replaced with its value, FRED. No problem figuring out where the symbolic name started or ended.
Now suppose you wanted to run 3 programs: FRED1, FRED2 and FRED3. You could do something like:

  //RUN3 EXEC PGM=&MYPROG.3

Here, program FRED3 is being run. The symbol MYPROG terminated by a period and equates to FRED, to this the
rest of the text is added yielding FRED3.

Same thing applies when using symbolic parameters within dataset names. The first period is needed to terminate
the symbol name, the next period is part of the dataset name itself. For example, if symbol USER evaluates to
ABC123, then

  //MYDSN DD DSN=&USER..MYDATA

evaluates to ABC123.MYDATA as a data set name. Similarly,

  //MYDSN DD DSN=&USER.X.MYDATA

evaluates to: ABC123X.MYDATA Note that the resulting DSN has a single period, because the first one
terminated the symbolic name and is not part of the result.

鱼窥荷 2025-01-14 12:42:11

简单来说,如果一个符号参数后面有一个句点(.),则需要额外添加一个句点(.),从而产生2个句点(.)。

根据您的情况,您必须使用两个句点 (.) 是正确的。

此讨论说第一个句点用于连接,而其他人则说它是符号变量的终止。但这并不重要。第二个句点成为数据集名称的一部分。

示例:

如果 &USER 解析为 USR01,那么它将被解释为

//JUSR01 JOB 1
//MYSTEP EXEC PGM=MYPROG
//MYDATA DD DSN=USR01.MYCLASS.COOL

仅在数据集中使用第二个句点。

但是,想象一下,如果你有这样的东西,会发生什么

//MYDATA DD DSN=&USER.MYCLASS.COOL

数据集将类似于 USR01MYCLASS.COOL。这是一个错误,因为每个级别不应超过 8 个字符。

In simple terms, if a symbolic parameter is followed by a period (.), then an additional period (.) needs to be added, thus resulting in 2 periods (.).

Based on your scenario, it is correct that you must use two periods (.).

This discussion said that the first period is used for concatenation, while some others said that it's part of the termination of the symbolic variable. But it doesn't really matter. The second period becomes part of the dataset name.

Example:

If &USER resolved as USR01, then it will be interpreted as

//JUSR01 JOB 1
//MYSTEP EXEC PGM=MYPROG
//MYDATA DD DSN=USR01.MYCLASS.COOL

Only the second period will be used in your dataset.

But, imagine if you have something like this, what will happen

//MYDATA DD DSN=&USER.MYCLASS.COOL

The dataset will be something like USR01MYCLASS.COOL. This is an error, as each level shouldn't have more than 8 characters.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文