The COMPARE-ELEMENT statement (see "COMPARE-ELEMENT") is used to compare members. The members are compared one record at a time, where the range of the comparison operation can be defined with the RECORD-PART operand. Comparison statistics are always produced.
The COMPARE-ELEMENT statement is also executed even if only one of the comparison members is found in the specified libraries. This allows the counting of records in members.
If two members are compared with one another, LMS uses the terms primary member and secondary member. The user is free to select the new or the old member as the base member. LMS always considers the secondary member to be the base for the comparison. This means that LMS identifies missing records in the secondary member as inserted records and missing records in the primary member as deleted records.
The differences established can be logged if requested (INFORMATION operand). This log is referred to as a comparison log. Following the comparison log, the SHOW-STATISTICS statement can be used to output the comparison statistics in the form of a table showing the results of the comparison in terms of numbers.
When deciding whether two records match, a distinction is made between formal and logical comparison.
In formal comparisons all record characters are compared, while in logical comparisons blanks are ignored.
The results of the two comparison modes (formal and logical) are logged in the same way.
Comparison log
Normally, the compared parts of the records are logged and not the complete records.
In the comparison log the results are based on the comparison of two ranges, the secondary member being taken as the point of reference.
Comparison | Meaning |
SAM | The compared parts of the two records in the primary and secondary |
DEL | The record with this comparison range only occurs in the secondary |
INS | The record with this comparison range only occurs in the primary |
Comparison statistics
The comparison statistics are displayed by means of the SHOW-STATISTICS statement
(see "SHOW-STATISTICS").
The comparison statistics supply the following information about a comparison:
total number of records compared in primary and secondary members
number of records inserted
number of records deleted
number of identical records.
In addition the result of the entire comparison is indicated:
S (same) | No differences were found during the comparison. |
C (changed) | Differences were found during the comparison. |
I (inserted) | The secondary member was not found. |
D (deleted) | The primary member was not found. |
ERR (error) | An error occurred during the comparison. |