HPlogo QUERY/V Reference Manual: HP 3000 MPE/iX Computer Systems > Chapter 3 QUERY/V COMMANDS

SUBSET

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

Retrieves entries from a select file.

Syntax

   SUB[SET] [#LIMIT=i] {relation

                        item identifier M[ATCHING]"pattern"}



   [{AND

     OR} {relation

          item identifer M[ATCHING]"pattern"}] ... [END]

Parameters

i

is an integer specifying the maximum number of qualifying entries you want to retrieve. When the #LIMIT parameter is specified, only the first i qualifying entries are placed in the select file. If fewer than i entries exist, then all entries that qualify are put in the select file.

item identifier

takes the form:

   [data base name:] [data set name.

                      dummy data set name.] data item name



   [(subscript)]

data base name is the name of a data base specified in either the DEFINE, DATA-BASE=, or MULTIDB command.

data set name is the name of a data set in the current data base.

dummy data set name is a temporary data set name used in multiple data set access (refer to the JOIN command).

data item name is the name of a data item contained in the data base. If a data set name is used, the data item must belong to the specified data set. To use the MATCHING option, the data item must be type X or U.

subscript is a number indicating which sub-item to access. Subscript must be an integer >= 1 and <= the number of sub-items defined for the compound item. QUERY will default to the first sub-item if no subscript is specified.

MATCHING

allows you to retrieve data based on the comparison of data items with a specified "pattern". Refer to the FIND command for a detailed description of MATCHING.

"pattern"

pattern must be enclosed in quotation marks. Refer to the FIND command for further specifications.

relation

takes the form:

   [data base name:] [data set name.

                      dummy data set name.] data item name



   [(subscript)] relop {"value"

                        $MISSING} [,{"value"

                                     $MISSING}]...

data item name can be of any data type.

relop is a relational operator as shown in Table 3-10 “Overpunch Characters”.

value is the data item value. It must be the same type and within the same value range as the data item named in the relation. Value need not be enclosed in quotation marks unless the value contains special characters. A value which is not contained in quotation marks is upshifted. For example, California is converted to CALIFORNIA before it is compared to data item values in the data base. Value must be an exact match for character type data items (type U and X). You can use null values. Refer to "Using Null Values" under the FIND command.

$MISSING is used to retrieve a missing (non-compound) entry from a compound data set. Refer to the MULTIFIND command for more information.

END

must be included in a procedure.

Discussion

This command provides a specialized kind of retrieval by selecting subsets of previously retrieved entries. It operates in a similar manner to the FIND command except that it searches only entries already in the select file established by the most recent retrieval command.

All data items named in the SUBSET command must belong to the data set(s) accessed in the most recent FIND or MULTIFIND command.

Up to 50 logical connectors (AND,OR) can be used in a SUBSET command. Refer to "Logical Connectors" under the FIND command.

When the SUBSET command is entered, the current select file is saved as a temporary file which can be restored and made accessible through the use of the UNDO command. (Note: the SAVE command saves the current select file as a permanent file.) The temporary select file is then examined for the subset of entries you request. Those entries that qualify are placed in the new current select file. If you use the UNDO command, you will no longer have access to those entries retrieved by the most recent SUBSET command.

Table 3-12 Retrieval Command Relational Operators

OPERATORMEANING
= IS IE EQis equal to (Multiple values may be used with these operators.)
# <> ISNOT INE NEis not equal to (Multiple values may be used with these operators.)
< ILT LTis less than
>= INLT GEis not less than (is greater than or equal to)
> IGT GTis greater than
<= INGT LEis not greater than (is less than or equal to)
IB value1, value__2__is between (and including) value__1__ and value__2__
 Note: The operators <>, <=, and >= cannot have any intervening spaces (embedded blanks).

 

Example

   >FIND PERIODICAL.JOURNAL="LIFE SCIENCES"

   >SUBSET PERIODICAL.YEAR=85

   >SAVE MFILE

In the example above, the SUBSET command only searches those entries that qualified from the FIND command. The SAVE command saves entries from the current select file as a permanent file named MFILE.

Feedback to webmaster