HP 3000 Manuals

SUBSET [ QUERY/V Reference Manual ] MPE/iX 5.0 Documentation


QUERY/V Reference Manual

SUBSET 

Retrieves entries from a select file.

Syntax 

                    {relation                            }
SUB[SET] [#LIMIT=i] {item identifier M[ATCHING] "pattern"}

[{AND} {relation                            }]
[{OR } {item identifier 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 set name.      ]
                       [data base 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.

                                         [data set name.      ]
                       [data base name:] [dummy data set name.]

                            data item name [(subscript)]  relop 

                       {"value" } [ {"value" }]
                       {$MISSING} [,{$MISSING}]...

                       data item name can be of any data type.

                       relop is a relational operator as shown in Table
                       3-6.

                       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-8.  Retrieval Command Relational Operators 

---------------------------------------------------------------------------------------------
|                           |                                                               |
|         OPERATOR          |                            MEANING                            |
|                           |                                                               |
---------------------------------------------------------------------------------------------
|                           |                                                               |
|     =                     | is equal to                                                   |
|     IS                    | (Multiple values may be used with these operators.)           |
|     IE                    |                                                               |
|     EQ                    |                                                               |
|                           |                                                               |
---------------------------------------------------------------------------------------------
|                           |                                                               |
|     #                     | is not equal to                                               |
|     <>                    | (Multiple values may be used with these operators.)           |
|     ISNOT                 |                                                               |
|     INE                   |                                                               |
|     NE                    |                                                               |
|                           |                                                               |
---------------------------------------------------------------------------------------------
|                           |                                                               |
|     <                     | is less than                                                  |
|     ILT                   |                                                               |
|     LT                    |                                                               |
|                           |                                                               |
---------------------------------------------------------------------------------------------
|                           |                                                               |
|     >=                    | is not less than (is greater than or equal to)                |
|     INLT                  |                                                               |
|     GE                    |                                                               |
|                           |                                                               |
---------------------------------------------------------------------------------------------
|                           |                                                               |
|     >                     | is greater than                                               |
|     IGT                   |                                                               |
|     GT                    |                                                               |
|                           |                                                               |
---------------------------------------------------------------------------------------------
|                           |                                                               |
|     <=                    | is not greater than (is less than or equal to)                |
|     INGT                  |                                                               |
|     LE                    |                                                               |
|                           |                                                               |
---------------------------------------------------------------------------------------------
|                           |                                                               |
|     IB value1 , value2      | is between (and including) value1  and value2                   |
|                           |                                                               |
---------------------------------------------------------------------------------------------
|                           |                                                               |
|                           | 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.



MPE/iX 5.0 Documentation