我的任务是从第一个文件中读取一条记录,并从第二个文件中检查相应的记录并显示它。这是我的代码:
PERFORM READ-PARA1 THRU END-PARA UNTIL WS-END-OF-FILE.
PERFORM READ-PARA2 THRU END-PARA UNTIL WS-END-OF-FILE.
CLOSE FILEX.
CLOSE FILEY.
STOP RUN.
READ-PARA1.
READ FILEX
AT END
MOVE 'Y' TO WS-EOF-IND.
DISPLAY SPACE
DISPLAY OCODE1,' 'ACODE1,' 'POLNO1,' 'EDATE1,
' 'PHOLD1,' 'LOCATION1,' '.
READ-PARA2.
READ FILEY
READ FILEY
AT END
PERFORM READ-PARA3 UNTIL R1 = 4.
IF POLNO1 = POLNO2
DISPLAY ' ',
LICNO1,' 'VMAKE1,' 'VMODEL,' 'YEAR,' 'PREM
ELSE
READ FILEY NEXT RECORD
GO TO READ-PARA2.
END-PARA.
EXIT.
READ-PARA3.
CLOSE FILEY.
OPEN INPUT FILEY.
READ FILEY
AT END
MOVE 'Y' TO WS-EOF-IND.
ADD 1 TO R1.
IF POLNO1 = POLNO2
DISPLAY ' ',
DISPLAY ' ',
LICNO1,' 'VMAKE1,' 'VMODEL,' 'YEAR,' 'PREM
ELSE
READ FILEY NEXT RECORD
GO TO READ-PARA3.
此代码仅用于查找文件 1 的第一条记录的相应记录,但其余所有显示为空白,并且都是顺序文件。