HPlogo QUERY/V Reference Manual: HP 3000 MPE/iX Computer Systems > Chapter 1 INTRODUCING QUERY/V

STRUCTURE OF THE DATA BASE

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

It is not necessary to understand all the IMAGE features in order to use QUERY. However, it is important to have a general idea of data base structure and know the definitions of some IMAGE terms which will be used in this manual.

Each item of information in a data base is referenced by a data item name. The name associates the information with characteristics which describe it:

  • the type of information (numeric, alphanumeric, etc.)

  • its relation to other data in the data base

  • the passwords required to read and/or write the information

The data base designer organizes data items into data sets for the purpose of accessing them as a group. For example, an employee data set could contain the items EMPID, F-NAME, L-NAME, SOCSEC#, and SALARY. A credit union data set could contain EMPID, AMOUNT, TRANSCODE, and so forth. Each data set is referenced by a data set name.

Each time you enter a new employee's record into the data base, you can supply a value for each data item. This group of values is stored as a single data entry in the data set. For example:


   F-NAME              SALLY

   L-NAME              MERTON

   SOCSEC#             527-58-6492

   SALARY              18000.02

QUERY allows you to locate particular entries which have values you specify. You can then change the values or print them in a report. You can also add or delete an entire entry if your password gives you the capability to write to each item in the data set.

You can use the FORM command to display the names of each data set to which you have access and the names of the data items in those sets. Only the items to which you have at least read access are listed.

Fully-Qualified Data Item Names

If you are referring to a data item which appears in more than one data set and/or data base, you must specify which data set and data base to access. A particular data item can appear in more than one data set within a given data base, and a particular data item can appear in more than one data base. You can specify the data item in three ways:

  • by specifying the data set through the DATA-SET= command and the data base through the DBLIST= command.

  • by specifying the data set through the DEFINE command (DATA-SETS= prompt) or through the MULTIDB command (DATA-SETS= prompt).

  • by qualifying the data item name.

A fully-qualified data item name has the following form:

data base name:data set name.data item name

For example:

[fig1a]

BADGE# is the name of a data item in the data set named LABOR which is in a data base named IRONCO. If BADGE# is also the name of a data item in a data set named EMPLOYEE, which is also in the IRONCO data base, its fully-qualified name would be IRONCO:EMPLOYEE.BADGE#.

Data Types

The data base designer defines each data item as a particular type, depending on what kind of information is to be stored in the item. A data item may be one of several types of integers, real or floating-point numbers, or ASCII character information.

The FORM command can display the data type for each item. When using QUERY, you will usually be unconcerned with the specific data type with the following exceptions:

  • when supplying values for an item, either to enter new information or to locate specific entries, you may want to know the acceptable range of values for a numeric type item.

  • when creating reports you should be aware of the item types in order to format the report properly.

  • when using the QUERY registers while printing a report, it is helpful to know how calculations affect the register values.

Detailed information about each of these situations is given with the appropriate command in Section 3. Table 1-1 “Data Item Types and Values” contains a summary of the data item types and the range of acceptable values for each.

Data Values

If you use QUERY to enter a value for a data item of type P (packed decimal), you should be aware of the way QUERY handles the sign of the value. A different code is used for the sign of a value entered with a plus sign than for a value entered without a sign. However, when QUERY retrieves unsigned and positive type P data items with the same value, they are considered to be equivalent. For example, +2 and 2 are equivalent. Data items with values +0, 0, and -0 are also equivalent.

Literals

When specifying the value of a particular data item, you must sometimes surround the value with quotation marks. This type of value is called a literal. A character or string literal contains alphanumeric characters. For example:

   "TANYA OAKLEY"       "ZXR=93458273"       "3215"

Character literals containing numeric values of the types listed under Integer or Real in Table 1-1 “Data Item Types and Values” are called, more specifically, numeric literals. For example:

   "5468"               "+408E-15"           "-16.73892"

Rules for using quotation marks are described with the commands which allow or require their use.

Table 1-1 Data Item Types and Values

TYPEMINIMUMMAXIMUM
INTEGER  
I1-32768+32767
I2-2,147,483,648+2,147,483,647
I4+9,223,372,036,845,775,808+9,223,372,036,854,775,807
J1-9999+9999
J2-999999999+999999999
J4-999999999999999999+999999999999999999
K10+65535
K20+4,294,967,295
Zn[1]- (n digit number)+ (n digit number)
Pn[1]- (n - 1 digit number)"+ (n - 1 digit number)"
REAL  
R2-1.157920 × 1077+0.863617 × 10-77
 -0.863617 × 10-77+1.157920 × 1077
  Largest accurate absolute integer is 8,388,607. (QUERY rounds to 6 digits when printing R2 values.)
R4-1.157920892373161 × 1077+0.8636168555094445 × 10-77
 -0.8636168555094445 × 10-77+1.157920892373161 × 1077
  Largest accurate absolute integer is 36,028,797,018,963,967. (QUERY rounds to 16 digits when printing R4 values.)
CHARACTER   
Un[2]1 ASCII character (lower case not allowed)n ASCII characters (lower case not allowed)
Xn[2]1 ASCII character"n ASCII characters

Notes on Table 1-1 “Data Item Types and Values”.

[1][2]

[1] * n cannot exceed 255 and must be even for type Z and evenly divisible by 4 for type Pn. QUERY reports print at most 20 digits for type Z and 19 digits for type P data values.

[2] ** n cannot exceed 255. QUERY reports print at most 136 characters for type U and X data values.

 

Compound Data Items

IMAGE allows the data base designer to specify compound data items. A compound data item is one that occurs more than once in the same data entry. Each occurrence of the data item is called a sub-item. Each sub-item can have a value, and QUERY can locate and update any or all sub-items. If you update only the first sub-item, QUERY preserves the existing values of all other sub-items.

Data Set Relations

There are three types of IMAGE data sets: manual master, automatic master, and detail. Master data sets are related to detail data set through specific items called search (or key) items. The FORM command identifies the data set type and search items.

The data base designer can specify one or more sort items. These items are also identified by the FORM command. As a QUERY user, it is not necessary to understand the function of sort items. If you want to know more about data set relations and sort items, refer to the IMAGE Reference Manual description of the data base structure.

Sample Data Base

Figure 1-1 “ORDERS Data Base Structure” and Figure 1-2 “Sample Entry Values” illustrate a sample data base named ORDERS. The data base is used in many examples in this manual. It contains six data sets. The four master data sets are shown in the center column and the detail data sets on the sides.

  • CUSTOMER contains information about each customer.

  • SUP-MASTER contains information about each supplier.

  • PRODUCT contains information about each product.

  • DATE-MASTER is an index of dates and can be used to retrieve information by date from the SALES or INVENTORY data sets.

  • SALES contains credit and purchase information.

  • INVENTORY contains product supply information.

Both figures show a single entry for each data set. Figure 1-1 “ORDERS Data Base Structure” contains the data item names, and Figure 1-2 “Sample Entry Values” contains a sample of the values in one entry. The arrows in both figures illustrate the relationship of the data sets through search items.

Figure 1-1 ORDERS Data Base Structure

[ORDERS Data Base Structure]

Figure 1-2 Sample Entry Values

[Sample Entry Values]

Note: This data base is not meant to be a practical application but rather is designed to illustrate as many IMAGE/QUERY features as possible.