Comparing Contents of Files
To compare the contents of two files to see if they are identical, use the COMPARE command from the CMS command line. The comparison is made on a record-for-record basis and dissimilar records are displayed to the terminal.
For example, suppose two files exist with the following contents:
EMPLOYEE LIST A EMPLOYEE LIST B
Kathy Kathy
Diana Diana
Kate Kate
Kathy Kathy
Diana Diana
Kate Kate
To compare the contents of EMPLOYEE LIST A with EMPLOYEE LIST B,
the following command would be entered:
compare employee list a employee list b
The
following message would be returned indicating that contents of the
files are identical:
DMSCMP179I Comparing EMPLOYEE LIST A with EMPLOYEE LIST B
Ready; T=0.30/0.03 08:06:21
If, in the second file, employee Kate was replaced by new employee
Terri, the COMPARE command would return the following:
DMSCMP179I Comparing EMPLOYEE LIST A with EMPLOYEE LIST B
Kate
Terri
DMSCMP209W Files do not compare
Ready(00004); T=0.01/0.01 08:08:15
The line from each file which
did not match is displayed.Since the comparison is done a record-for-record basis, the insertion or deletion of a line may return misleading results. For example, if EMPLOYEE LIST2 A was an identical copy of EMPLOYEE LIST A, and the name of a new employee, Tom, was inserted in the file, so the contents of the files were:
EMPLOYEE LIST A EMPLOYEE LIST2 A
Kathy Tom
Diana Kathy
Kate Diana
Kate
Kathy Tom
Diana Kathy
Kate Diana
Kate
The result of a compare on these files would be:
DMSCMP179I Comparing EMPLOYEE LIST A with EMPLOYEE LIST B
Kathy
Tom
Diana
Kathy
Kate
Diana
DMSCMP010E Premature EOF on file EMPLOYEE LIST A
Ready(00004); T=0.01/0.01 08:14:09
The COMPARE command did not
recognize the that files were identical except for one line. It simply
compared each line on a line-by-line or record-for-record basis and
displayed each dissimilar record. It did, however, indicate that one
file contained more records than the other.For more information on the COMPARE command, see z/VM: CMS Commands and Utilities Reference.