![]() |
![]() HP OpenVMS Systemsask the wizard |
![]() |
The Question is: Is there a DCL method of performing a "reverse merge" (eg., $ RMERGE F1 F2 /OUT=F3) where F1 and F2 are sorted recordsets and F3 contains only records in F1 that are NOT in F2? The Answer is : Assuming sorted sequential text records in the two files, this is possible using roughly a dozen lines of DCL -- some basic file operations (OPEN, CLOSE), and a read-and-compare-records loop. The DIFFERENCES command can also be used to achieve this result for text files. Use the /SEPARATED and /NONUMBERS qualifiers. For example: $ DIFFERENCES/NONUMBER/SEPARATED=REVISION F1 F2 /OUTPUT=F3 /SEPARATED=REVISION says the output file should contain only the records in F2 that are not in F1 (/SEP=MASTER does the opposite). /NONUMBER requests that the records will be listed without numbers, and this will cause text records to be copied exactly. While the output file will contain the usual header and trailer information, it is quite simple to remove this information from the file using an editor, using some simple DCL, or using some other tool.
|