The compare-list BASIC program forms a single list from two lists using the intersection, union, or exclusion operators.
Syntax
compare-list {file.reference.a}lista operator {file.reference.b}listb {file.reference.c} {listc} {(options)}
or, if the primary and secondary lists are already active:
compare-list operator{listc}{(options}
Parameter(s)
|
file.reference.a |
File that contains the list specified in lista. |
|
|
lista |
First list. CAUTION— This argument will be treated as a filename first, then as a listname. Thus, if a file with the same name as the listname (specified in lista) exists in the file specified in file.reference.a, an error will occur. |
|
|
file.reference.b |
File that contains the list specified in listb. |
|
|
listb |
Second list. CAUTION— This argument will be treated as a filename first, then as a listname. Thus, if a file with the same name as the listname (specified in listb) exists in the file specified in file.reference.b, an error will occur. |
|
|
file.reference.c |
File that contains the list specified in listc. |
|
|
listc |
Third list. CAUTION— This argument will be treated as a filename first, then as a listname. Thus, if a file with the same name as the listname (specified in listc) exists in the file specified in file.reference.c, an error will occur. |
|
|
operators |
& |
Represents an and or intersection, which means that the item-IDs must exist in both lists. |
|
# |
Represents a not or exclusion, which means that the item IDs must not exist in both lists. |
|
|
= |
Represents an or union, indicating that the item-IDs can exist in either list. |
|
|
+ |
Concatenates listb to the end of lista. For example: lista + listb |
|
|
- |
Removes item-IDs in listb from lista. For example: lista - listb |
|
|
options |
g |
Performs a get-list on listc. For example, makes listc active after the process. |
|
s |
Generates and displays statistics about the items selected during the process. If this option is not used, no message displays. |
|
The compare-list command performs the operation (&, #, =, +, or -) on lista and listb and creates a new list, listc. If listc is not specified, it overwrites lista.
Example(s)
Assume that these two lists below are already created and reside in the pointer-file file.
|
list1 |
list2 |
|
001 cat |
001 banana |
|
002 dog |
002 apple |
|
003 banana |
003 orange |
compare-list list1 + list2
Since no listc was specified, list1 is overwritten and contains banana, cat, dog, apple, banana, and orange.
compare-list list1 + list2 list3
This example is exactly the same as the first example, but the list is saved as list3. list1 and list2 remain unchanged.
compare-list list1 # list2 list3
Creates a list3, which contains apple, cat, dog, and orange, since none of these display in both list1 and list2. list1 and list2 remain unchanged.
compare-list list1 = list2 list3 (gs
|
list2 |
list1 |
list3 |
Sort time - faster than a speeding second. |
|
3 |
3 |
5 |
Duty time - faster than a speeding second. |
|
[404] 5 items selected out of 1 items. |
|||
Creates and activates list3, which contains apple, banana, cat, dog, and orange, or all unique strings in both list1 and list2. list1 and list2 remain unchanged.
compare-list list1 - list2 list3
Creates a list3, which contains cat and dog. Those strings, which exist in list2 (banana, in this case) are removed from list1. list1 and list2 remain unchanged.
compare-list list1 & list2 list3
Creates a list3, which contains banana, since it is the only string, which displays in both list1 and list2. list1 and list2 remain unchanged.
See Also