SSAMPLE Command

The SSAMPLE command creates and sorts a temporary select-list of the first n items in a file that match the specified criteria. This command is useful when you want to test a small number of items. For example, you might want to test 100 items in a file rather than process all 10,000 items.

Format

SSAMPLE [DICT] filename [item-list] [selection] [sort-keys] [output] (n)

Parameter(s)

DICT

Specifies the file dictionary.

filename

Name of the file.

item-list

List of individual item-IDs that you want to select or compare against specified criteria. Enclose each item-ID in single quotes.This parameter overrides n.

selection

Specifies one or more conditions that an item must meet to be included in the select-list. For a complete description of selection expression syntax, see the LIST Command.

sort-keys

Specifies which attributes to sort and whether to sort them in ascending or descending order. You can use the following modifiers with sort-keys:

BY

Sorts items in ascending order by the specified attribute.

BY-DSND

Sorts items in descending order by the specified attribute.

BY-EXP

Sorts a MultiValued attribute in ascending order and produces a separate line for each value.

BY-EXP-DSND

Sorts a MultiValued attribute in descending order and produces a separate line for each value.

If more than one sort-key is specified in a SSAMPLE command line, the system sorts these attributes from left to right (the leftmost sort-key is the most significant).

output

Name of an attribute whose values are to be selected. Each value becomes a separate item-ID in the select-list.

n

Number of items to sample.

Description

The SSAMPLE command creates a temporary select-list containing, in sorted order, the first n 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.

CAUTION

Only the statement immediately following the SSAMPLE statement has access to the select-list. In other words, you must use the select-list immediately, or you will 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 SSAMPLE 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.

Selecting and Sorting a Specified Number of Items

The following example creates a select-list containing the first four items in the ORDERS file whose sale date is January 15, 1994:

>SSAMPLE ORDERS WITH DATE = "01/15/94" (4)

4 ITEMS SELECTED.

If you list these items with the list command, they appear in sorted order:

>LIST ORDERS

 

0134

0156

0179

0234

 

4 ITEMS LISTED.