OpenCOBOL 复杂 ODO(发生情况取决于)

发布于 2024-10-19 12:26:06 字数 1361 浏览 4 评论 0原文

我是 COBOL(和 OpenCOBOL)的新手,我的问题是关于 OpenCOBOL 中的“complex-odo”(发生...取决于)。

我在以下代码中使用了 1.0

......

01  W-PTDO-PROC-TBL.
       05  W-PTDO-PROC-ENTRY OCCURS 0 TO 450 TIMES
             DEPENDING ON W-PTDO-PROC-MAX
             INDEXED BY W-PTDO-PROC-INDX.
           10 W-PTDO-PROC-APC        PIC X(05).
           10 W-PTDO-PROC-LNSUB      PIC S9(07)   COMP-3.
           10 W-PTDO-PROC-KEY.
               15 W-PTDO-PROC-WA-OFFSET  PIC 9(08)V99.
               15 W-PTDO-PROC-UNITS      PIC 9(09).
           10 W-PTDO-PROC-DEVICE-CNT PIC 9(03).
           10 W-PTDO-PROC-DARRAY OCCURS 0 TO 450 TIMES
                DEPENDING ON W-PTDO-DARRAY-MAX
                INDEXED BY W-PTDO-DARRAY-INDX.
               15  W-PTDO-PROC-DHCPCS PIC X(05).
           10 W-PTDO-DARRAY-SIZE     PIC 9(03).
           10 W-PTDO-PROC-TOT-DCHRGS PIC 9(10)V99.
           10 W-PTDO-PROC-TOT-DUNITS PIC 9(05).
           10 W-PTDO-PROC-USED       PIC X(01).

......

并且 cobc 返回此错误消息:

错误:“W-PTDO-PROC-ENTRY”由于“W-PTDO-PROC”而无法具有 OCCURS 子句-DARRAY'

以上错误消息是从 field.c 发出的,我在其中找到了此评论 /* 包含 OCCURS DEPENDING 子句的数据项不应从属于具有 OCCURS 子句的数据项 */

是否有办法使 OpenCOBOL 支持这种“complex-odo”?

我上面的代码片段,其中“OCCURS DEPENDING”嵌套在更高级别的“OCCURS”子句下,根据 IBM 的 COBOL 编程指南的附录,似乎是一个定义明确的“complex-odo”。

谢谢你,

比利·荣

I am new to COBOL(and OpenCOBOL) and my question is about "complex-odo" (OCCURS...DEPENDING ON) in OpenCOBOL.

I used 1.0 on following code

......

01  W-PTDO-PROC-TBL.
       05  W-PTDO-PROC-ENTRY OCCURS 0 TO 450 TIMES
             DEPENDING ON W-PTDO-PROC-MAX
             INDEXED BY W-PTDO-PROC-INDX.
           10 W-PTDO-PROC-APC        PIC X(05).
           10 W-PTDO-PROC-LNSUB      PIC S9(07)   COMP-3.
           10 W-PTDO-PROC-KEY.
               15 W-PTDO-PROC-WA-OFFSET  PIC 9(08)V99.
               15 W-PTDO-PROC-UNITS      PIC 9(09).
           10 W-PTDO-PROC-DEVICE-CNT PIC 9(03).
           10 W-PTDO-PROC-DARRAY OCCURS 0 TO 450 TIMES
                DEPENDING ON W-PTDO-DARRAY-MAX
                INDEXED BY W-PTDO-DARRAY-INDX.
               15  W-PTDO-PROC-DHCPCS PIC X(05).
           10 W-PTDO-DARRAY-SIZE     PIC 9(03).
           10 W-PTDO-PROC-TOT-DCHRGS PIC 9(10)V99.
           10 W-PTDO-PROC-TOT-DUNITS PIC 9(05).
           10 W-PTDO-PROC-USED       PIC X(01).

......

and cobc returns with this error msg:

Error: 'W-PTDO-PROC-ENTRY' cannot have the OCCURS clause due to 'W-PTDO-PROC-DARRAY'

And above error msg is issued from field.c where I found this comment
/* the data item that contains a OCCURS DEPENDING clause shall not be subordinate to a data item that has the OCCURS clause */

Is there anyway to make OpenCOBOL support this "complex-odo"?

My above code snippet, with "OCCURS DEPENDING" nested under a higher level "OCCURS" clause, seems to be a well-defined "complex-odo" according to appendix of IBM's COBOL Programming Guide.

Thank you,

Billy Rong

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

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

发布评论

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

评论(1

樱花坊 2024-10-26 12:26:06

您不能在另一个数组中包含可变长度数组(取决于发生情况)!

所需的处理过于复杂。如果允许内部数组项的长度变化,则计算外部数组第 N 个条目的开始的唯一可能方法是顺序访问从 1 到 N 的每个内部成员,并使用 DEPENDING ON 计数来计算其长度,以及下一个数组条目的开始。

You cannot have a variable length array (OCCURS DEPENDING ON) inside another array!

The processing required is just too complex. If the length of the inner array item was allowed to vary, the only possible way to calculate the start of the Nth entry of the outer array is to sequentially access each inner member from 1 to N and use the DEPENDING ON count to work out its length, and, hence the start of the next array entry.

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