MERGE – Merge SAVELIST output

Use the MERGE command to merge the contents of two lists into a single list with no duplicates.

MERGE <list1> AND|OR|XOR|NOT <list2> INTO <list3> [BY <fields>]

where:
<list1>
The name of the first SAVELIST to merge.
<list2>
The name of the second SAVELIST to merge.
<list3>
The name of the SAVELIST in which to store the results.
<fields>
Optional. The name of the fields to merge by.
The following list shows the different kinds of MERGE:
AND
Only output entries that are in both lists.
OR
Output the combined content of both lists.
XOR
Only output entries that are not in either list.
NOT
Only output entries that are in the first list but not in the second list.

The MERGE command combines the contents of two lists into a single list with no duplicates, based on the criteria. Ordinarily it uses the entire text of each SAVELIST entry to perform the MERGE, but you can use BY to restrict the MERGE criteria to named keywords in the SAVELIST text.

Note:
  • The MERGE technique relies upon the two lists being ordered in the sort sequence of the merging criteria. If you select criteria that do not match the sort sequence the results might not be as expected.
  • If an entry exists in both lists, with matching criteria, the entry from the first list is selected for output.
  • When merging LIST GENDAYS output it is recommended to code BY DATE IAT as criteria, because the GENDAYS SAVELIST also contains FLAGS that might often not match between entries for the same date.