如何在cobol中移动表(数组)的多个元素
我有一个数组,其中包含 CSV 文件中的记录。例如,我可以使用 move 语句将元素 5 到 10 移出到工作存储中吗?类似于:将 ExampleArray(5:10) 移至 WS-TEST。我被告知这是可能的,而不必循环遍历数组。但我似乎无法以这种方式编译它。
I have an array which holds a record from a CSV file. Can I for example use the move statement to move elements 5 to 10 out into working storage? Something like: MOVE ExampleArray(5:10) TO WS-TEST. I have been told this is possible instead of having to loop through the array. But I can not seem to get it to compile this way.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您使用的语法称为引用修改。它相当于其他语言中的 substring() 。您的示例代码将尝试从 ExampleArray+5 移动 10 个字节。
支持“ALL”下标概念。它有局限性,但它可能会做你想要的。尝试类似的方法:
根据您的编译器,它可能会起作用。我认为规范将其使用限制为整数函数,但并非所有编译器都这样做。
说真的,执行循环非常简单和容易,只需编写以下代码:
The syntax you are using is called Reference Modification. It is the equivalent of substring() in other languages. Your example code would try to move 10 bytes from ExampleArray+5.
There is a "ALL" subscript concept that is supported. It has limitations, but it MIGHT do what you want. Try something like:
Depending upon your compiler, it MIGHT work. I think the spec limits its use to integer functions, but not all compilers do.
Seriously though, perform loops are very simple and easy, just code this: