我有两个文件File-1和File-2。两个文件中的记录都是按降序排列的。File-1的顶部可能有一些额外的记录。我想写入File-1中不存在于File-2中的所有记录。
File-1:- Sample
2019-08-06 XXXX
2019-08-06 XYXX
2019-08-06 XXYX
2019-08-05 XXYX
2019-08-05 XXYY
2019-08-04 XXYX
2019-08-03 XXYX
2019-08-03 XZYX
File-2:- Sample
2019-08-05 XXYX
2019-08-05 XXYY
2019-08-04 XXYX
2019-08-03 XXXX
2019-08-03 XZYX
Output:-
2019-08-06 XXXX
2019-08-06 XYXX
2019-08-06 XXYX
2019-08-03 XXYX请让我知道伪码。
发布于 2019-09-21 09:45:16
Open both input files for reading
Open output file for writing
while not eof file2
read file2
while file1 > file2 and not eof file1
read file1
write file1 to output
end while
end while发布于 2019-10-15 17:04:32
PERFORM 000-OPEN.
PERFORM 100-PROCESS THRU 100-PROCESS-EXIT
UNTILL END-File-1 AND END-File-2. (Where END-File will be declare as PIC X(2) VALUE '10')
PERFORM 200-CLOSE-FILE THRU 200-CLOSE-FILE-EXIT.
*************************************************************
000-OPEN.
will perform opening the 2 files in INPUT mode and 3 output file in OUTPUT
mode.
000-OPEN-EXIT.
**
100-PROCESS.
**
will perform READ operation for 2 input files, then will compare first
record from both files.
IF File-1(REC-1) NOT= File-2(REC-1)
WRITE File-3 (For unmatched Records)
READ File-1 AND File-2.
END-IF.https://stackoverflow.com/questions/57378850
复制相似问题