MERGE.LIST

MERGE.LIST

Top  Previous  Next

 

The MERGE.LIST command creates a new active select list by merging two other lists according to one of three relational operators.

 

 

Format

 

MERGE.LIST list1 rel.op list2 {TO tgt.list} {COUNT.SUP}

 

where

 

list1, list2identify the select lists to be merged. These must be select list numbers in the range 0 to 10. They may not reference the same list.

 

rel.opis the relational operator and is one of

 

INTERSECTIONCreate a new list containing only those record keys that appear in both list1 and list2. The keyword may be abbreviated to INTERSECT.

 

UNIONCreate a new list containing all record keys from both list1 and list2. Keys appearing in both lists appear only once in the resultant list.

 

DIFFERENCECreate a new list containing all record keys from list1 except those that are also in list2. The keyword may be abbreviated to DIFF.

 

tgt.listis the number of the select list (0 to 10) to receive the result. If omitted, select list zero is used. It is valid for tgt.list to reference one of the source lists.

 

COUNT.SUPindicates that display of the record count in the merged list is to be suppressed.

 

 

The MERGE.LIST command allows construction of one select list from two others. Use of MERGE.LIST can be significantly faster than a full select of the file to create the new list.

 

If either source list has already been partially processed before the MERGE.LIST command is executed, only the remaining unprocessed items are used. The resultant list will replace any already active tgt.list. The source lists are cleared after the new list has been set up. The ordering of tgt.list is undefined.

 

@SYSTEM.RETURN.CODE is set to the number of items in the new list or a negative error code.

 

 

Example

 

GET.LIST FRANCE.CUSTOMERS TO 1

27 records selected.

GET.LIST GERMANY.CUSTOMERS TO 2

31 records selected.

MERGE.LIST 1 UNION 2 TO 3

58 records selected.

 

This example restores two saved select lists, one holding keys for customers in France, the other for customers in Germany and merges these to form select list 3 as a list of customers in either of these countries.

 

 

See also:

LIST.DIFF, LIST.INTER, LIST.UNION