QSELECT Command

The QSELECT command creates a temporary select-list containing all values either in a specified attribute or in all attributes from all or selected file items. Each attribute value becomes an item-ID in the select-list. A subsequent command can then use the data in the select-list to reference item-IDs in another file.

Format

QSELECT [DICT] filename [item-list] [(attr)]

Parameter(s)

DICT

Specifies the file dictionary.

filename

Name of the file.

item-list

Lists individual item-IDs. Enclose each item-ID in single quotes. Use an asterisk (*) to select all items in filename.

attr

Attribute number (AMC) of the attribute whose data elements will be placed in the select-list. If attr is not specified, the QSELECT command selects all the attributes.

Description

QSELECT creates a temporary select-list containing item-IDs of the items specified in the item-list or the selection criteria. The items referenced by the select-list are processed by the next command you execute. For instance, before invoking the Editor you might create a select-list as a way of specifying which items you want to edit.

CAUTION

Only the statement immediately following the QSELECT statement have 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 QSELECT 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 File Attributes

Assume you have an ORDERS file whose item-IDs are order numbers and whose customer IDs are held in Attribute 4. You could use the QSELECT command to create a select-list of customer IDs from Attribute 4 for all customers who have placed orders. Using this active select-list, you could generate a report containing the customers’ names and addresses from the CUSTOMERS file. The resulting select-list would be the active customers.

Remember, if you used SELECT instead of QSELECT on the ORDERS file, the select-list would contain order IDs (item-IDs), not customer IDs.

The following example creates a select-list of customer IDs from Attribute 4 in the ORDERS file, then displays a report as described above:

>QSELECT ORDERS (4)

ITEM-ID: *

 

52 ITEMS SELECTED.

>LIST CUSTOMERS LAST-NAME FIRST-NAME STREET CITY STATE

 .

 .

 .