Cobol 动态调用如何使用组作为程序标识符来工作?

发布于 2025-01-05 15:11:33 字数 1510 浏览 4 评论 0原文

我有以下调用语句:

038060     CALL        PROG USING
038070                 DFH
038080                 L000
038090                 ZONE-E
038100                 ZONE-S.

此调用是动态的并使用PROG

PROG 是一个定义为的组:

018630 01                 XX00.
018640        10          PROG.
018650         15         XX00-S06  PICTURE X(6)
018660                         VALUE  SPACE.
018670         15         XX00-S02  PICTURE X(2)
018680                         VALUE  SPACE.
018690        10          XX00-S92  PICTURE 9(02)
018700                         VALUE  ZERO.
018710        10          XX00-S91  PICTURE 9(1)
018720                         VALUE  ZERO.
018730        10          XX00-S9Z PICTURE 9(1)
018740                         VALUE  ZERO.
018750        10          XX00-9B0 PICTURE X(05)
018760                         VALUE  SPACE.
018770        10          XX00-0B0 PICTURE X(02)
018780                         VALUE  SPACE.
018790        10          XX00-BB1 PICTURE X(01)
018800                         VALUE  SPACE.
018810        10          XX00-SFN PICTURE X(07)
I cut here but there is a lot of field after...

似乎要使用的实际 progname 存储在:

XX00-S06

XX00-S02

我还有其他情况,其中名称位于 3 或 4 个字段,并且程序名称长度并不总是 8。

所以我的问题是 Cobol 如何知道在组中哪里选择好的程序名称?解析规则是什么?

配置:我使用Microfocus Net Express编译器,环境是UniKix。

I have the following call statement :

038060     CALL        PROG USING
038070                 DFH
038080                 L000
038090                 ZONE-E
038100                 ZONE-S.

This call is dynamic and use PROG.

PROG is a group defined as :

018630 01                 XX00.
018640        10          PROG.
018650         15         XX00-S06  PICTURE X(6)
018660                         VALUE  SPACE.
018670         15         XX00-S02  PICTURE X(2)
018680                         VALUE  SPACE.
018690        10          XX00-S92  PICTURE 9(02)
018700                         VALUE  ZERO.
018710        10          XX00-S91  PICTURE 9(1)
018720                         VALUE  ZERO.
018730        10          XX00-S9Z PICTURE 9(1)
018740                         VALUE  ZERO.
018750        10          XX00-9B0 PICTURE X(05)
018760                         VALUE  SPACE.
018770        10          XX00-0B0 PICTURE X(02)
018780                         VALUE  SPACE.
018790        10          XX00-BB1 PICTURE X(01)
018800                         VALUE  SPACE.
018810        10          XX00-SFN PICTURE X(07)
I cut here but there is a lot of field after...

It seems that actual progname to use is stored in :

XX00-S06

and

XX00-S02

I've also other cases where the name is on 3 or 4 fields, and the progname length is not always 8.

So my question is how Cobol know where to pick the good program name in the group? What are the resolution rules?

Configuration : I use Microfocus Net Express compiler and the environment is UniKix.

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

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

发布评论

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

评论(2

想你的星星会说话 2025-01-12 15:11:33

COBOL 中的动态调用规则相当简单。给定类似的内容:

    CALL WS-NAME USING...

COBOL 将根据加载模块库解析当前存储在 WS-NAME 中的程序名称
可用它基于
线性搜索。使用与 WS-NAME 匹配的第一个匹配的加载模块入口点名称。

WS-NAME 的定义有多复杂或多简单并不重要。用于名称的总长度
WS-NAME 的长度。例如:

   01 WS-NAME.
      05 WS-NAME-FIRST-PART     PIC X(3).
      05 WS-NAME-MIDDLE-PART    PIC X(2).
      05 WS-NAME-LAST-PART      PIC X(3).

WS-NAME 由 3 个从属字段组成,总共 8 个字符。您可以单独填充这些或只是移动
将某些内容纳入 WS-NAME 作为一个整体。如果 WS-NAME 的长度小于 8 个字符,则尾随字符将为
在任何接收字段上设置为空格。例如:

  01 WS-SHORT-NAME.
     05 WS-SHORT-NAME-FIRST-PART          PIC X(4) VALUE 'AAAA'.
     05 WS-SHORT-NAME-LAST-PART           PIC X(2) VALUE 'BB'.

这里 WS-SHORT-NAME 只有 6 个字符长。 将 WS-SHORT-NAME 移动到任何更长的 PIC X 类型变量,如下所示:

  MOVE WS-SHORT-NAME TO WS-NAME

将导致 WS-NAME 的值为“AAAABBbb” '(注意两个尾随空格)。图书馆检索期间
对于匹配的入口点名称,尾随空格并不重要,因此您可以在 CALL 语句中使用
要么:

  CALL WS-NAME

要么

  CALL-WS-SHORT-NAME

他们将解析到相同的入口点。

我不确定 MicroFocus COBOL 的长度规则是什么,但是对于 IBM z/os 动态调用
程序名称不能超过 8 个字符(如果超过,名称将被截断为 8 个字符)。

Dynamic call rules in COBOL are fairly simple. Given something like:

    CALL WS-NAME USING...

COBOL will resolve the program name currently stored in WS-NAME against the load module libraries
available to it based on
a linear search. The first matching load module entry point name that matches WS-NAME is used.

It doesn't matter how complex, or simple, the definition of WS-NAME is. The total length used for the name
is whatever the length of WS-NAME is. For example:

   01 WS-NAME.
      05 WS-NAME-FIRST-PART     PIC X(3).
      05 WS-NAME-MIDDLE-PART    PIC X(2).
      05 WS-NAME-LAST-PART      PIC X(3).

WS-NAME is composed of 3 subordinate fields giving a total of 8 characters. You can populate these individually or just move
something into WS-NAME as a whole. If the length of WS-NAME is less than 8 characters, the trailing characters will be
set to spaces on any receiving field. For example:

  01 WS-SHORT-NAME.
     05 WS-SHORT-NAME-FIRST-PART          PIC X(4) VALUE 'AAAA'.
     05 WS-SHORT-NAME-LAST-PART           PIC X(2) VALUE 'BB'.

Here WS-SHORT-NAME is only 6 characters long. MOVING WS-SHORT-NAME to any longer PIC X type variable as in:

  MOVE WS-SHORT-NAME TO WS-NAME

Will result in WS-NAME taking on the value 'AAAABBbb' (note the two trailing spaces). During libary search
for a matching entry point name, the trailing spaces are not significant so on the CALL statement you could use
either:

  CALL WS-NAME

or

  CALL-WS-SHORT-NAME

And they will resolve to the same entry point.

I am not sure what the length rules are for MicroFocus COBOL but, for IBM z/os dynamically called
program names cannot exceed 8 characters (if they do, the name is truncated to 8 characters).

痴骨ら 2025-01-12 15:11:33

我将向 NeilB 添加更多关于 Micro Focus COBOL 的具体信息。

仅供参考:PROGRAM-ID、ENTRY-POINTS 限制为 30-31 个字符(请检查文档中的“系统限制和编程限制”部分)。

I will add little more to NeilB with specific information about Micro Focus COBOL.

fyi: PROGRAM-ID, ENTRY-POINTS are restricted to 30-31 characters (check your "System Limits and Programming Restrictions" section in the docs).

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