Previous Topic: CommandsNext Topic: Syntax


COMPARE

To identify differences between two data sets, use the COMPARE command. The data sets can be sequential, VSAM, or partitioned. If the data set is partitioned, the list of members to compare can be specified in the MEMBER keyword. If the MEMBER keyword is omitted, all members will be compared. You can compare load modules or program objects using COMPARE PROGRAM.

The COMPARE command has many keywords that provide flexibility in how the compare is performed. You can tailor the compare to exclude records based on selection criteria, compare part of a record or the entire record, or compare records in a sequential file based on an "implied" key.

To specify the ddnames of the files to be compared, use the OLDFILE and NEWFILE keywords. If you omit these keywords, the installation defaults for OLDFILE and NEWFILE are SYSUT1 and SYSUT1N, respectively. These defaults may have been changed by the &BAT_OLDFILE and &BAT_NEWFILE installation options.

As records are compared, the default compare report prints the mismatched records from both the OLDFILE and the NEWFILE. You can enhance the default report by specifying report related keywords. These keywords can be used to produce formatted reports by using copybooks to map the data and to print records in either character or hex mode. Additionally, you can tailor the report to print: all records compared, only mismatched records, or a compare summary report. The compare report writes to the SYSLIST DD statement. If it SYSLIST was omitted, then it is written to SYSPRINT.

Use the POSITION keyword to include only specific record positions in the comparison Any record positions not mentioned with the POSITION keyword are excluded from the comparison.

You can write records identified as CHANGED, DELETED, INSERTED, and MATCHED to their own output file. Therefore you can generate a file that contains only the DELETED records.

You can also compare the content of a program at the machine instruction (or disassembled) level. Specify FORMAT(INSTRUCTION) to perform this operation.

The following rules apply to the COMPARE PROGRAM command:

Note: For a list of all the keywords the COMPARE command supports, see Keywords in this section.