带有文件控制的 Cobol 程序,如下所示:
SELECT D-FLAT-FILE ASSIGN TO DFLAT-FILE
ORGANIZATION IS INDEXED
ACCESS MODE IS SEQUENTIAL
FILE STATUS IS RECORD-STAT
RECORD KEY IS D_KEY OF D-FLAT-FILE DESCENDING WITH DUPLICATES.
SELECT C-MAST-FILE ASSIGN TO CMAST-FILE
ORGANIZATION IS INDEXED
ACCESS MODE IS DYNAMIC
FILE STATUS IS RECORD-STAT
RECORD KEY IS C_KEY OF C-MAST-FILE.
从第一个平面文件中读取记录,如下所示:
PROCESSING.
READ D-FLAT-FILE NEXT RECORD
AT END ....END READ.
并读取第二个 DYNAMIC 文件的记录,如下所示:
READ C-MAST-FILE RECORD
INVALID KEY
GO TO PROCESSING.
除了 1 个案例外,一切都很好。如果来自第一个平面文件的第一条记录与第二个动态文件中的任何记录都不匹配,则程序将进入无限循环而不是执行转到处理。我检查了手册,全部按照手册(它是 VAX Cobol)。我错过了什么?