The NSELECT command creates a new select-list containing only those items in the current select-list that are not in the specified file. In order to use the NSELECT command, you must have just created or retrieved a select-list with one of the following commands: SELECT, SSELECT, SAMPLE, SSAMPLE, FIND, QSELECT, or GET-LIST.
Format
NSELECT filename |
Parameter(s)
filename |
Name of the file against which the current select-list is compared. |
Description
The NSELECT command creates a new select-list containing item-IDs of only those items in the previous select-list that are not also in filename. The items referenced by the new select-list are processed by the next command executed.
CAUTION |
Only the statement immediately following the NSELECT statement has access to the select-list. In other words, you must use the select-list immediately, or you lose it! |
To permanently save the select-list, use the SAVE-LIST command. Once a select-list is saved, you can retrieve it at any time with the GET-LIST command.
A select-list can reference data in any file, not just the file specified in the original SELECT statement. If two files have similar items with the same item-IDs, you can create a select-list from one file, then use it to operate on items from the other file.
Creating a Select-list from Items Not in a Specified File
Assume you want to create a list of customers whose accounts are active. First, create a select-list from the CUSTOMERS file:
>SELECT CUSTOMERS |
Then compare the select-list to the item-IDs in the CUSTOMERS.INACTIVE file:
>NSELECT CUSTOMERS.INACTIVE |
The select-list now contains customer IDs from the CUSTOMERS file for only those customers not in the CUSTOMERS.INACTIVE file. By listing the CUSTOMERS file, you can now list only active customers:
>LIST CUSTOMERS . . . |