QUERY/V Reference Manual: HP 3000 MPE/iX Computer Systems > Chapter 1 INTRODUCING QUERY/VSTRUCTURE OF THE DATA BASE |
|
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 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. 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:
A fully-qualified data item name has the following form: data base name:data set name.data item name For example: 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#. 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:
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. 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. 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:
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:
Rules for using quotation marks are described with the commands which allow or require their use. Table 1-1 Data Item Types and Values
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. 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. 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.
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. 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. |