搜索表 (COBOL)
我第一次尝试使用桌子,但遇到了一个小障碍。我已经弄清楚如何制作表格,但我不知道如何搜索表格或将存储的信息移动到另一个字段。这是表格:
01 SALESMAN-TABLE.
05 TABLE-ENTRIES OCCURS 99 TIMES.
10 SALESMAN-NUMBER PIC 99 VALUE ZEROS.
10 SALESMAN-NAME PIC X(20) VALUE SPACES.
01 SALESMAN-COUNT PIC 9(3) VALUE ZEROS.
这是我到目前为止尝试搜索数据的内容:
510-TABLE-SEARCH.
SEARCH TABLE-ENTRIES
WHEN SALESMAN-NUMBER (ROUTINE-CHECK) = ROUTINE-CHECK
PERFORM 520-WRITE-FILE
WHEN SALESMAN-NUMBER (ROUTINE-CHECK) = 0
CONTINUE
END-SEARCH.
这就是我用来移动数据的内容:
SET DL-NAME-COLUMN TO SALESMAN-NAME
但它说 DL-NAME-COLUMN 应该是数字,即使 SALESMAN-NAME 是字母数字。我应该怎么办?任何帮助将不胜感激。
I have been trying to use a table for the first time and I have hit a small snag. I have figured out how to make a table, but I cannot figure out how to search the table or move the stored information to another field. Here is the table:
01 SALESMAN-TABLE.
05 TABLE-ENTRIES OCCURS 99 TIMES.
10 SALESMAN-NUMBER PIC 99 VALUE ZEROS.
10 SALESMAN-NAME PIC X(20) VALUE SPACES.
01 SALESMAN-COUNT PIC 9(3) VALUE ZEROS.
This is what I got so far to try and search for data:
510-TABLE-SEARCH.
SEARCH TABLE-ENTRIES
WHEN SALESMAN-NUMBER (ROUTINE-CHECK) = ROUTINE-CHECK
PERFORM 520-WRITE-FILE
WHEN SALESMAN-NUMBER (ROUTINE-CHECK) = 0
CONTINUE
END-SEARCH.
And this is what I am using to move the data:
SET DL-NAME-COLUMN TO SALESMAN-NAME
but it says that DL-NAME-COLUMN should be numeric even though SALESMAN-NAME is alphanumeric. What should I do? Any help will be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该使用以下内容对表进行索引:
然后您可以使用 SEARCH 动词:
表索引始终是数字,因为它们用作指针(它们包含内存地址)。 SET 动词通常用于修改表索引。
You should index your table using something like:
Then you can use the SEARCH verb:
Table indices are always numeric since they are used as pointers (they contain a memory address). The SET verb is normally used to modify table indices.
使用
而不是
Use
instead of