HP 3000 Manuals

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


QUERY/V Reference Manual

LIST 

Prints complete or partial entries from a single data set with automatic
formatting and headings.

Syntax 

                         {data set name }
L[IST] [data base name:] {data item list}

[             [{AND}         ]   ]
[FOR relation [{OR } relation]...] [END]

For example:

     >LIST LABOR FOR BADGE# IE "09.18" AND F-NAME IE JOE

Where data set name = LABOR, relation = BADGE# IE "09.18", and relation =
F-NAME IE JOE

     >LIST BADGE#,F-NAME,L-NAME

Where data item list = BADGE#,F-NAME,L-NAME

     >L LABOR

Where data set name = LABOR

Parameters 

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 a currently open data
                       base.

data item list         is a list of either simple data item names or
                       compound data items with an optional (subscript),
                       separated by commas.  All data items must be from
                       the same data set, and can be listed in any order.
                       A data item cannot be qualified with a data set
                       name, but the first data item can be qualified
                       with a data base name.

                       subscript is a number to indicate which sub-item
                       you want to locate.  Subscript is entered with
                       parenthesis and must be an integer > 1 and <= to
                       the number of sub-items defined for the compound
                       item.  QUERY will default to the first sub-item if
                       no subscript is specified.

relation               takes the form:

                            [data set name.] data item name [(subscript)]

                               relop "value" [,"value"]...

                       data item name is the name of a data item
                       contained in the data set.  If you use data set 
                       name preceding the FOR, it is not necessary to
                       qualify any data item names with the data set
                       name.  If you precede the FOR with a data item 
                       list, you can qualify the data item in the first
                       relation with a data set name.

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

                       value is a data item value.  It must be the same
                       type and within the same value range as the data
                       item named in the relation.  A value need not be
                       enclosed in quotation marks (") unless the value
                       contains special characters.  Any value not
                       contained within 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 may
                       use null values.  Refer to "Using Null Values"
                       under the FIND command for more information.

END                    must be included in a procedure.

          Table 3-3.  LIST 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).                         |
|                           |                                                               |
---------------------------------------------------------------------------------------------

Discussion 

The maximum number of logical connectors (AND, OR) which can be used in
the LIST command is 10.  Refer to "Logical Connectors" under the FIND
command.

The LIST command prints all or a subset of the data item values from a
single data set.  It is one of the simplest ways to report on your data
since you do not need to design a report or specify the format and
headings.

LIST always uses a serial read.

Listing Format 

The data is printed in columns.  The width of the columns (or fields) is
determined by the data item type.  Table 3-4 summarizes field widths.
QUERY provides two spaces between the fields.

Data item names are printed as column headings at the top of each page.
If the complete data item name is longer than the field width, it is
truncated.  Headings of character type data items are left-justified and
numeric types are right-justified.

If all of the data you request does not fit on one line (in one record),
data items at the end of the data item list or the data entry are
ignored.  The line length varies with the device you are using.  It is
usually 72 to 80 characters for a terminal and a maximum of 136
characters for a line printer.

          Table 3-4.  Field Widths of Data Item Types 

---------------------------------------------------------------------------------------------
|                                       |                                                   |
|               ITEM TYPE               |            FIELD SIZE (in characters)             |
|                                       |                                                   |
---------------------------------------------------------------------------------------------
|                                       |                                                   |
|                  I1                   |                         6                         |
|                                       |                                                   |
|                  I2                   |                        11                         |
|                                       |                                                   |
|                  I4                   |                        20                         |
|                                       |                                                   |
|                  J1                   |                         5                         |
|                                       |                                                   |
|                  J2                   |                        10                         |
|                                       |                                                   |
|                  J4                   |                        19                         |
|                                       |                                                   |
|                  K1                   |                         5                         |
|                                       |                                                   |
|                  K2                   |                        10                         |
|                                       |                                                   |
|                  R2                   |                        12                         |
|                                       |                                                   |
|                  R4                   |                        22                         |
|                                       |                                                   |
|                  Zn                   |                n+1 (maximum = 20)                 |
|                                       |                                                   |
|                  Pn                   |                 n (maximum = 20)                  |
|                                       |                                                   |
|                  Un                   |            n (maximum = line length)*             |
|                                       |                                                   |
|                  Xn                   |            n (maximum = line length)*             |
|                                       |                                                   |
---------------------------------------------------------------------------------------------
|                                       |                                                   |
|                                       | * Absolute maximum = 136                          |
|                                       |                                                   |
---------------------------------------------------------------------------------------------

Listing a Subset of the Data 

You can list a subset of the data in three ways:

   1.  Use the data item list form of the commands to specify particular
       items you want to list.  For example:

            >LIST F-NAME,L-NAME,SERVICEYRS 

       lists the values of F-NAME,L-NAME, and SERVICEYRS for each entry
       in the set.  This form is useful if the complete data entry does
       not fit on one line.  You can change the order of the data items
       and print the last ones in the data entry first or print only the
       last items.

   2.  Use the FOR parameter to set criteria for selection of entries
       from the set.  For example:

            >LIST LABOR FOR SERVICEYRS GE 5 

       lists the value of all data items in each entry of the LABOR data
       set containing SERVICEYRS values greater than or equal to 5.

   3.  It is also possible to combine these techniques.  For example:

            >LIST F-NAME,L-NAME FOR SERVICEYRS GE 5 

       lists the full names of each person entered in the set whose years
       of service (SERVICEYRS) total is greater than or equal to 5.  Note
       that the data item used as selection criteria need not be in the
       data item list.

Determining the Data Set to be Used 

If you use the LIST command form specifying a data set name, there is no
ambiguity as to which information will be listed.  If you use a data item 
list, you should consider the following:

 *  If the command has a FOR clause, QUERY uses the data item in the
    first relation to determine the data set to be listed.

 *  If there is no FOR clause, QUERY uses the last item in the data item 
    list.

In either case, if the data item appears in only one data set, that set
(or a subset of it) is listed.  If it appears in more than one set and it
is qualified, the named data set is listed.  Otherwise, QUERY uses the
data set list and follows the rule described with the DATA-SET= command.

The Relation of LIST and FIND 

The entries selected by the LIST command are not available for any other
purpose except the output of this command.  The entries selected by the
most recent FIND command are unaffected by LIST and are still available
for use with UPDATE and REPORT commands.

Examples 

Example 1 

In the example below, QUERY could not locate the required entry until the
value was entered with the correct spacing.

     >L CUSTOMER FOR STREET-ADDRESS="  868       DOYLE ROAD" 

     >L CUSTOMER FOR STREET-ADDRESS="868 DOYLE ROAD" 

      ACCOUNT     LAST-NAME     FIRST-NAME     IN     STREET ADDRESS

     10034765     SLATER        GENEVA         K      868 DOYLE ROAD

Example 2 

In the next example, the data item values for INVENTORY with STOCK# equal
to 6650D22S are listed.

     >L INVENTORY FOR STOCK#=6650D22S 

     STOCK#   ONHANDQTY    SUPPLIER        UNIT-COS    LASTSH  BIN

     6650D22S      5306    ACME                1427    120385    3
     6650D22S       600    HEWLETT-PACKARD    12500    111585    3
     6650D22S         3    H & S SURPLUS          0    121585    0
     6650D22S       999    H & S SURPLUS       1500    120585    0
     6650D22S        13    H & S SURPLUS       1445    121485    3

Example 3 

In this example, the data item values for SALES with STOCK# equal to
6650D22S are listed.

     >L SALES FOR STOCK#=6650D22S 

      ACCOUNT    STOCK#    QUANTI     PRICE    TAX   TOTAL  PURCH-

     24536173    6650D22S       3       598     20       0  120885
     24566356    6650D22S       1     12500    750       0  121585

Example 4 

This example lists CUSTOMER entries with ACCOUNT greater than 55555555.

     >LIST CUSTOMER FOR ACCOUNT GT 55555555 

       ACCOUNT   LAST-NAME     FIRST-NAME    IN   STREET-ADDRESS

      76623455   MCFALL        JEFFEREY      X   6650 MONTEREY RD
      74001813   FIELD         HUBERT        J   4556 GEARY
      87654321   JONES         JOHN          P   1 PINE AVE

Example 5 

Since all the values of each entry in the previous example do not fit on
one line, this example lists by the data item names in order to get the
items at the end of each entry.

     >LIST LAST-NAME,STREET-ADDRESS,CITY,STATE FOR ACCOUNT GT 55555555 
     ACCOUNT        IS A MEMBER OF THESE SETS:
     CUSTOMER,SALES
     WHICH SET DO YOU WISH TO USE?
     >>CUSTOMER 

     LAST-NAME      STREET-ADDRESS          CITY          ST

     MCFALL         6650 MONTEREY ROAD      CARMEL        CA
     FIELD          4556 GEARY              CUPERTINO     CA
     JONES          1 PINE AVE              CAMPBELL      CA

Example 6 

This example lists all STOCK# in the data set INVENTORY.

     >LIST STOCK# 
     STOCK#         IS A MEMBER OF THESE SETS
     PRODUCT,SALES,INVENTORY
     WHICH SET DO YOU WISH TO USE?
     >>INVENTORY 

       STOCK#

     6650D22S
     2457A11C
     3586T14Y

Example 7 

Since QUANTITY is in the SALES data set and is part of the first
relation, SALES data set STOCK# values are printed.  SALES is
automatically added to the data set list.

     >LIST STOCK# FOR QUANTITY IGT 2 AND ACCOUNT ILT 88888888 

       STOCK#

     6650D22S
     3586T14Y
     5405T14F
     7892Z43Y

Example 8 

SALES and INVENTORY are both in the data set list so QUERY must prompt
you for the data set.

     >LIST STOCK# 
     STOCK#         IS A MEMBER OF THESE SETS
     SALES,INVENTORY
     WHICH SET DO YOU WISH TO USE?
     >>INVENTORY 

     6650D22S
     2457A11C
     3586T14Y
     5405T14F
     6650D22S
     7892Z43R



MPE/iX 5.0 Documentation