合并语句 (COBOL)
我正在开发一个程序,需要使用合并语句将两个文件放在一起并对它们进行排序。当然,如果我没有问题的话我就不会在这里。当我运行程序时,我必须随后做一些工作才能添加到输出中。当它执行该段落时,它会给出一个错误,提示“合并文件超出序列 ORDER-FILE-SOR”。这是我的代码:
100-MAIN.
MERGE ORDERS-FILE-SORT
ON ASCENDING KEY REQUEST-DATE-S
ON ASCENDING KEY CUST-NUMBER-S
ON ASCENDING KEY CUST-ORDER-NUMBER-S
ON ASCENDING KEY PART-NUMBER-S
USING ORDERS-FILE-PRIOR-IN
ORDERS-FILE-NEW-IN
OUTPUT PROCEDURE 200-FILE-START
STOP RUN.
200-FILE-START.
OPEN OUTPUT ORDERS-FILE-OUT
ACCEPT WS-DATE FROM DATE
MOVE RUN-MONTH TO MONTH-1
MOVE RUN-DAY TO DAY-1
MOVE RUN-YEAR TO YEAR-1
PERFORM 300-NEXT-PAGE
PERFORM UNTIL ARE-THERE-MORE-RECORDS = 'NO '
RETURN ORDERS-FILE-SORT
AT END
MOVE 'NO ' TO ARE-THERE-MORE-RECORDS
NOT AT END
PERFORM 400-PROCESS-FILE
END-RETURN
END-PERFORM.
CLOSE ORDERS-FILE-OUT.
它显示的输出是标题行,它似乎停在“RETURN ORDERS-FILE-SORT”行。
任何帮助将不胜感激,因为我觉得程序的其余部分将运行得很好,但在修复此问题之前我无法检查它。
I was working on a program that needed to use a merge statement to put two files together and sort them. Of course though I would not be here if I didn't have a problem. When I run my program I have to do a little work afterward to add to the output. When it it goes to perform that paragraph it gives an error that says "Merge File out of sequences ORDER-FILE-SOR". Here is my code:
100-MAIN.
MERGE ORDERS-FILE-SORT
ON ASCENDING KEY REQUEST-DATE-S
ON ASCENDING KEY CUST-NUMBER-S
ON ASCENDING KEY CUST-ORDER-NUMBER-S
ON ASCENDING KEY PART-NUMBER-S
USING ORDERS-FILE-PRIOR-IN
ORDERS-FILE-NEW-IN
OUTPUT PROCEDURE 200-FILE-START
STOP RUN.
200-FILE-START.
OPEN OUTPUT ORDERS-FILE-OUT
ACCEPT WS-DATE FROM DATE
MOVE RUN-MONTH TO MONTH-1
MOVE RUN-DAY TO DAY-1
MOVE RUN-YEAR TO YEAR-1
PERFORM 300-NEXT-PAGE
PERFORM UNTIL ARE-THERE-MORE-RECORDS = 'NO '
RETURN ORDERS-FILE-SORT
AT END
MOVE 'NO ' TO ARE-THERE-MORE-RECORDS
NOT AT END
PERFORM 400-PROCESS-FILE
END-RETURN
END-PERFORM.
CLOSE ORDERS-FILE-OUT.
The output it does show is the heading line and it seems to stop at the "RETURN ORDERS-FILE-SORT" line.
Any help would be greatly appreciated as I feel the rest of the program will run just fine, but I can't check it till this is fixed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
MERGE 动词组合两个或多个顺序相同的文件。要使其工作,您必须已经根据一组相同的升序/降序键对它们进行排序。
如果您的输入尚未按该顺序排列,您可能需要按 REQUEST-DATE-S、CUST-NUMBER-S、CUST-ORDER-NUMBER-S 和 PART-NUMBER-S 对每个文件进行排序
The MERGE verb combines two or more identically sequenced files. To have it work, you must have already sorted them according to an identical set of ascending/descending keys.
If your input is not already in that order, you might need to sort each file by REQUEST-DATE-S, CUST-NUMBER-S, CUST-ORDER-NUMBER-S and PART-NUMBER-S