HP 3000 Manuals

User-Generated Dictionary Source File [ HP ALLBASE/BRW Reference Manual ] MPE/iX 5.0 Documentation


HP ALLBASE/BRW Reference Manual

User-Generated Dictionary Source File 

You can generate a dictionary source-file that is a simple MPE file
containing a list of "statements" you specify according to your needs.
These are later converted into the HP ALLBASE/BRW BRWDIC by the program
BRWGEND.

Typically, you include the statements in a text file -- an unnumbered MPE
file that you create with a text editor.  The various kinds of
statements, along with their syntax and semantics, are described in later
sections of this chapter.

Terminology 

Terminology in the user-generated dictionary source file and HP
ALLBASE/BRW is not always the same.  The table below shows the
differences in terminology:

-------------------------------------------------------------------------------------------
|                                                                                         |
|               HP ALLBASE/BRW                       HP User-Generated Dictionary         |
|                                                                                         |
-------------------------------------------------------------------------------------------
|                                                                                         |
| Item                                        Element                                     |
|                                             Item is entity of a record                  |
|                                                                                         |
| Format                                      Record/Item relation                        |
|                                                                                         |
-------------------------------------------------------------------------------------------

Creating the Dictionary Source-File 

The dictionary source-file can contain the following types of statements.
You must always specify the statements in this order:

       TITLE/SCHEMA statements

       FILE statements

       ELEMENT statements

       RECORD statements

       ITEM statements (repeated for each record)

       BUILD statements

The next example, shown below and continued on the next page, illustrates
a user-generated dictionary:source file, using the sample database TOYDB.
_____________________________________________________________
|                                                           |
|                                                           |
|     TITLE "description of database TOYDB"                 |
|     FILE products TYPE IMAGE MASTERS OF toydb             |
|     FILE order-master TYPE IMAGE AUTOMATIC MASTER OF toydb|
|     FILE customers TYPE IMAGE MASTER OF toydb             |
|     FILE order-details TYPE IMAGE DETAIL OF toydb         |
|     FILE orders TYPE IMAGE DETAIL OF toydb                |
|     FILE invoices TYPE IMAGE DETAIL OF toydb              |
|                                                           |
|     ELEMENT product-no X(6)                               |
|     ELEMENT product-name X(16)                            |
|     ELEMENT price 9(7)V9(2)                               |
|     ELEMENT product-line X(2)                             |
|     ELEMENT quantity 9(5)                                 |
|     ELEMENT order-no X(8)                                 |
|     ELEMENT customer-no X(6)                              |
|     ELEMENT customer-no-b X(3)                            |
|     ELEMENT customer-no-e X(3)                            |
|     ELEMENT customer-name X(30)                           |
|     ELEMENT city X(30)                                    |
|     ELEMENT state X(30)                                   |
|     ELEMENT zipcode X(6)                                  |
|     ELEMENT address X(30)                                 |
|     ELEMENT sales-area X(16)                              |
|     ELEMENT turnover X(15)V9(2)                           |
|     ELEMENT turnover-py X(15)V9(2)                        |
|     ELEMENT turnover-mtd X(15)V9(2)                       |
|     ELEMENT shipment-date DATE                            |
|     ELEMENT ship-date-month X(2)                          |
|     ELEMENT ship-date-day X(2)                            |
|     ELEMENT order-date DATE                               |
|     ELEMENT order-date-month X(2)                         |
|     ELEMENT order-date-day X(2)                           |
|     ELEMENT invoice-no X(6)                               |
|     ELEMENT invoice-date DATE                             |
|     ELEMENT due-date DATE                                 |
|     ELEMENT amount 9(11)V9(2)                             |
|     ELEMENT paid-amount 9(11)V9(2)                        |
|                                                           |
|     RECORD products                                       |
|        ITEM product-no KEY                                |
|        ITEM product-name                                  |
|        ITEM price PACKED SIZE 4                           |
|        ITEM product-line                                  |
|        ITEM quantity INTEGER                              |
|                                                           |
|     RECORD order-master                                   |
|        ITEM order-no KEY                                  |
|                                                           |
|     RECORD customers                                      |
|        ITEM customer-no KEY                               |
|        ITEM customer-name                                 |
|        ITEM city                                          |
|        ITEM state                                         |
|        ITEM zipcode                                       |
|        ITEM address                                       |
|        ITEM sales-area                                    |
|        ITEM turnover PACKED SIZE 8 OCCURS 12              |
|        ITEM turnover-py PACKED SIZE 8                     |
|        ITEM turnover-mtd PACKED SIZE 8                    |
|                                                           |
|                                                           |
_____________________________________________________________

            

(Continued...)
________________________________________
|                                      |
|                                      |
|     RECORD order-details             |
|        ITEM order-no KEY             |
|        ITEM product-no KEY           |
|        ITEM quantity INTEGER         |
|        ITEM shipment-date DATE-MD    |
|           REDEFINED BY               |
|     ITEM ship-date-month             |
|     ITEM ship-date-day               |
|           END                        |
|                                      |
|     RECORD orders                    |
|        ITEM customer-no KEY          |
|        ITEM order-no KEY             |
|        ITEM order-date DATE-MD       |
|           REDEFINED BY               |
|     ITEM order-date-month            |
|     ITEM order-date-day              |
|           END                        |
|                                      |
|     RECORD invoices                  |
|        ITEM invoice-no               |
|        ITEM customer-no KEY          |
|        ITEM order-no KEY             |
|        ITEM amount PACKED SIZE 6     |
|        ITEM paid-amount PACKED SIZE 6|
|        ITEM invoice-date DATE-MD     |
|        ITEM due-date DATE-MD         |
|                                      |
|     BUILD                            |
|                                      |
|                                      |
|                                      |
________________________________________

            

Statements 

The statements in the user-generated source file consist of three parts,
in the following order:

------------------------------------------------------------------------------------------
|                                                                                        |
|    Statement type                               Description                            |
|                                                                                        |
------------------------------------------------------------------------------------------
|                                                                                        |
| Keyword               A keyword is a word defined by the system.  These words can be   |
|                       used as file names only if a percent sign (%) in inserted before |
|                       the word (i.e.  %file)                                           |
|                                                                                        |

| Name                  A name must:                                                     |
|                                                                                        |
|                          *   Be 1 to 20 characters long.                               |
|                                                                                        |
|                          *   Begin with a $, @, #, or letter, which must be followed   |
|                              by:                                                       |
|                                                                                        |
|                                 *   any alphabetical characters from A through Z       |
|                                                                                        |
|                                 *   any digit from 1 through 9                         |
|                                                                                        |
|                                 *   any of the following special characters:           |
|                                                                                        |
|                                          _ # %                                         |
|                                                                                        |
| Options               Not all statements must include options - you specify them as    |
|                       required.                                                        |
|                                                                                        |
------------------------------------------------------------------------------------------

Syntax Rules 

   *   If you are typing in a statement and there is not enough space to
       write everything in that line, type in an ampersand (&) at the end
       of the line and type in the rest of the statement in the line
       below; using the ampersand, you can continue to type in a
       statement on several lines.

   *   Enclose comments in semi-colons (;).  Note that if the end of the
       comment is the end of the text on that line, the semicolon (;) is
       not necessary.

                  ;comment comment comment;

   *   You cannot write a second comment within a comment.

The TITLE or SCHEMA Statement 

The TITLE or SCHEMA statement consists of the key words TITLE or SCHEMA,
followed by a string of up to forty characters enclosed in double quotes
(").  With the TITLE or SCHEMA statement you do not instruct the BRWGEND
program to create anything.  This statements simply marks the beginning
of the specification process.

[SCHEMA] "characterstring"
[TITLE ]

The FILEStatement 

With the FILE statement you specify a format and its type.  A format can
be either one of the following:

   *   An MPE or a KSAM file.

   *   A dataset:

          *   IMAGE MASTER

          *   IMAGE AUTOMATIC MASTER

          *   IMAGE DETAIL

The FILE statement consists of the keyword FILE, followed by the name,
the type, and the OPEN option (this is optional).

      FILE mpefile            TYPE MPE
       FILE ksamfile TYPE KSAM
      FILE customers TYPE IMAGE MASTER OF toydb
      FILE customers-expldb TYPE IMAGE MASTER OF expldb
         & OPEN customers

The file name must be unique.  If you want to specify two formats (for
example from separate databases) which have the same name, you can use
the OPEN option to make the name unique.  The OPEN name then represents
the physical name of the format.

The ELEMENT Statement 

With the ELEMENT statement you specify an item, its type, display size,
and number of decimal positions.

The ELEMENT statement consists of the keyword ELEMENT, followed by the
name, the element type and element options.

      ELEMENT customer-name  X(30)
      ELEMENT quantity 9(5)
      ELEMENT turnover 9(15)V9(2)
      ELEMENT order-date DATE
      ELEMENT actual-time TIME              &
        HEADING "the actual time is displayed" &
        PICTURE "hh:mmpp"

The name of an element statement has to be unique.  You cannot specify
diverse elements with the same name even if they have different
characteristics.  You can, however, use the same element in multiple
record tables.

The element is usually of the type:

   *   X for character

   *   9 for numeric

   *   DATE or TIME

If the element is of the character- or numeric type, you must specify the
size.

In the example above, the element's type is character (X) which is a
customer's name thirty characters long, and the quantity is numeric, a
number five digits long.

Additionally, if the element's type is numeric, you can also specify the
number of decimal positions.  In the example above, turnover is a numeric
element seventeen digits long, including two digits to the right of the
decimal point.

      ELEMENT turnover 9(15)V9(2)

RECORD Statement 

With the RECORD statement you describe the relationship between the
record and item.  With the ITEM statement you assign the item a specific
characteristic which is only valid in that particular RECORD statement.

For every file which you specify in a FILE statement, there must be one
corresponding RECORD statement.

The RECORD statement consists of the keyword RECORD, followed by the name
of the record (which must be a name defined in a FILE statement), and one
or more ITEM statements.

      RECORD products
       ITEM product-no CHARACTER   KEY
       ITEM quantity INTEGER
       ITEM product-name CHARACTER

ITEM Statement 

The ITEM statement consists of the keyword ITEM, followed by the name of
the item, which must be a name defined in an ELEMENT statement.  (If you
wish, you can define the item type and size and item options.  However,
the BRWGEND program derives its own default values for type and size.)

-------------------------------------------------------------------------------------------
|                                                                                         |
|   Element Type          Size            Default Item Type     Default Item Size (Bytes) |
|                                                                                         |
-------------------------------------------------------------------------------------------
|                                                                                         |
| X(n)                      n         CHARACTER                             n             |
|                                                                                         |
| 9(n)                    n <=4       INTEGER                               2             |
|                                                                                         |
| 9(n)                    n <=9       DOUBLE                                4             |
|                                                                                         |
| 9(n)                    n > 9       LONG                                  8             |
|                                                                                         |
| DATE                      8         HPDATE                                2             |
|                                                                                         |
| TIME                      8         HPTIME                                2             |
|                                                                                         |
-------------------------------------------------------------------------------------------

The following table lists the item types in the user- generated
dictionary source-file and shows how they are handled by HP ALLBASE/BRW.

--------------------------------------------------------------------------------------------
|                                                                                          |
|  Element          Item Type          Length (words)     BRW                              |
|    Type                             (1 wd - 16 bits)    Type            Remarks          |
|                                                                                          |
--------------------------------------------------------------------------------------------
|                                                                                          |
|     X      CHARACTER                                     S     Max 255 Bytes             |
|                                                                                          |
|     9      LOGICAL                          1            I     logical                   |
|                                                                                          |
|     9      INTEGER                          1            I                               |
|                                                                                          |
|     9      DOUBLE                           2            I                               |
|                                                                                          |
|     9      BINARY4                          4            I                               |
|                                                                                          |
|     9      REAL                             2            R                               |
|                                                                                          |
|     9      LONG                             4            R                               |
|                                                                                          |
|     9      PACKED                                        N     packed                    |
|                                                                                          |
|     9      ZONED                                         N     zoned                     |
|                                                                                          |
|     9      DECIMAL                                       N     num, display              |
|                                                                                          |
|     9      FPDECIMAL2                       2            N     short floating point      |
|                                                                decimal                   |
|                                                                                          |
|     9      FPDECIMAL4                       4            N     HP Business Basic         |
|                                                                floating point decimal    |
|                                                                                          |
|    DATE    date-types                                    D     listed below              |
|                                                                                          |
|    TIME    time-types                                    T     listed below              |
|                                                                                          |
--------------------------------------------------------------------------------------------

For integer, decimal, packed, or zoned data, you can specify a size with
the SIZE keyword.  Unlike IMAGE or COBOL conventions, the HP ALLBASE/BRW
size is always in bytes.  For packed and zoned, the default SIZE in bytes
is (n + m)/Z + 1, where n + m comes from the ELEMENT defraction:

     ELEMENT TURNOVER 9(m) V9(m)

The next table lists the various date- and time types you can specify
with an ITEM statement in the MPE file in which you store all these
statements (in our example, the GENDEF file), as well as the required
length of the item and the type of the corresponding element definition.

          DATE TYPES Table 

-------------------------------------------------------------------------------------------
|                                                                                         |
|     Date/Time Keyword     Required Length (1wd  Required Element   Example:  (Date is   |
|                                = 16 bits)             Type              04/28/92)       |
|                                                                                         |
-------------------------------------------------------------------------------------------
|                                                                                         |
| DATE-DMY-D                8 Bytes               DATE              28/04/92              |
|                                                                                         |
| DATE-DMYY-D               10 Bytes              DATE              28/04/1992            |
|                                                                                         |
| DATE-MDY-D                8 Bytes               DATE              04/28/92              |
|                                                                                         |
| DATE-MDYY-D               10 Bytes              DATE              04/28/1992            |
|                                                                                         |
| DATE-YMD-D                8 Bytes               DATE              92/04/28              |
|                                                                                         |

| DATE-YYMD-D               10 Bytes              DATE              1992/04/28            |
|                                                                                         |
| DATE-DDY-D                6 Bytes               DATE              118/92                |
|                                                                                         |
| DATE-DDYY-D               8 Bytes               DATE              118/1992              |
|                                                                                         |
| DATE-YDD-D                6 Bytes               DATE              92/118                |
|                                                                                         |
| DATE-YYDD-D               8 Bytes               DATE              1992/118              |
|                                                                                         |
-------------------------------------------------------------------------------------------
|                                                                                         |
| DATE-DM-D                 5 Bytes               DATE              28/04                 |
|                                                                                         |
| DATE-MD-D                 5 Bytes               DATE              04/28                 |
|                                                                                         |
| DATE-MY-D                 5 Bytes               DATE              04/92                 |
|                                                                                         |
| DATE-MYY-D                7 Bytes               DATE              04/1992               |
|                                                                                         |
| DATE-YM-D                 5 Bytes               DATE              92/04                 |
|                                                                                         |
| DATE-YYM-D                7 Bytes               DATE              1992/04               |
|                                                                                         |
-------------------------------------------------------------------------------------------
|                                                                                         |
| DATE-DMY-I                3 Words               DATE                                    |
|                                                                                         |
| DATE-DMYY-I               3 Words               DATE                                    |
|                                                                                         |
| DATE-MDY-I                3 Words               DATE                                    |
|                                                                                         |
| DATE-MDYY-I               3 Words               DATE                                    |
|                                                                                         |
| DATE-YMD-I                3 Words               DATE                                    |
|                                                                                         |
| DATE-YYMD-I               3 Words               DATE                                    |
|                                                                                         |
| DATE-DDY-I                2 Words               DATE                                    |
|                                                                                         |
| DATE-DDYY-I               2 Words               DATE                                    |
|                                                                                         |
| DATE-YDD-I                2 Words               DATE                                    |
|                                                                                         |
| DATE-YYDD-I               2 Words               DATE                                    |
|                                                                                         |
-------------------------------------------------------------------------------------------
|                                                                                         |
| DATE-DM-I                 2 Words               DATE                                    |
|                                                                                         |
| DATE-MD-I                 2 Words               DATE                                    |
|                                                                                         |
| DATE-DD-I                 1 Word                DATE                                    |
|                                                                                         |
| DATE-MY-I                 2 Words               DATE                                    |
|                                                                                         |
| DATE-MYY-I                2 Words               DATE                                    |
|                                                                                         |
| DATE-YM-I                 2 Words               DATE                                    |
|                                                                                         |
| DATE-YYM-I                2 Words               DATE                                    |
|                                                                                         |
-------------------------------------------------------------------------------------------
|                                                                                         |
| HPDATE                    2 Bytes               DATE                                    |
|                                                                                         |
-------------------------------------------------------------------------------------------

          ACCSDEF DATE-ITEM Table 
          (NUMERIC and ALPHANUMERIC Format) 
-------------------------------------------------------------------------------------------
|                                                                                         |
|       Date Keyword        Required Length (1wd  Required Element   Example:  (Date is   |
|                                = 16 bits)             Type              04/28/92)       |
|                                                                                         |
-------------------------------------------------------------------------------------------
|                                                                                         |
| DATE-DMY                         6 Bytes        DATE              280492                |
|                                                                                         |
| DATE-DMYY                        8 Bytes        DATE              28041992              |
|                                                                                         |
| DATE-MDY                         6 Bytes        DATE              042892                |
|                                                                                         |
| DATE-MDYY                        8 Bytes        DATE              04281992              |
|                                                                                         |
| DATE-YMD                         6 Bytes        DATE              920428                |
|                                                                                         |
| DATE-YYMD                        8 Bytes        DATE              19920428              |
|                                                                                         |
| DATE-DDY                         5 Bytes        DATE              11892                 |
|                                                                                         |
| DATE-DDYY                        7 Bytes        DATE              1181992               |
|                                                                                         |
| DATE-YDD                         5 Bytes        DATE              92118                 |
|                                                                                         |
| DATE-YYDD                        7 Bytes        DATE              1992118               |
|                                                                                         |
-------------------------------------------------------------------------------------------
|                                                                                         |
| DATE-DM                          4 Bytes        DATE              2804                  |
|                                                                                         |
| DATE-MD                          4 Bytes        DATE              0428                  |
|                                                                                         |
| DATE-DD                          3 Bytes        DATE              118                   |
|                                                                                         |
| DATE-MY                          4 Bytes        DATE              0492                  |
|                                                                                         |
| DATE-MYY                         6 Bytes        DATE              041992                |
|                                                                                         |
| DATE-YM                          4 Bytes        DATE              9204                  |
|                                                                                         |
| DATE-YYM                         6 Bytes        DATE              199204                |
|                                                                                         |
-------------------------------------------------------------------------------------------

          TIME-ITEM Table (All Formats) 

-------------------------------------------------------------------------------------------
|                                                                                         |
|       Time Keyword        Required Length (1wd  Required Element   Example:  (Time is   |
|                                = 16 bits)             Type           3.43 pm/24secs)    |
|                                                                                         |
-------------------------------------------------------------------------------------------
|                                                                                         |
| TIME-HM24                        4 Bytes        TIME              1543                  |
|                                                                                         |

| TIME-HMS24                       6 Bytes        TIME              154324                |
|                                                                                         |
| TIME-HM12                        5 Bytes        TIME              0343P                 |
|                                                                                         |
-------------------------------------------------------------------------------------------
|                                                                                         |
| TIME-HM24-D                      5 Bytes        TIME              15:43                 |
|                                                                                         |
| TIME-HMS24-D                     8 Bytes        TIME              15:43:24              |
|                                                                                         |
| TIME-HP12-D                      6 Bytes        TIME              03:43P                |
|                                                                                         |
-------------------------------------------------------------------------------------------
|                                                                                         |
| TIME-HM24-I                      5 Bytes        TIME                                    |
|                                                                                         |
| TIME-HMS24-I                     8 Bytes        TIME                                    |
|                                                                                         |
-------------------------------------------------------------------------------------------
|                                                                                         |
| HPTIME                           4 Bytes        TIME                                    |
|                                                                                         |
-------------------------------------------------------------------------------------------

[REV BEG]

You can specify the following three item options when you are defining an
item itself:

   *   UNIQUE KEY

   *   KEY

   *   OCCURS n 
[REV END] 

If the record is either an IMAGE dataset or a KSAM file, you can label an
item as a KEY.

If the item is an array, you can specify the number of occurrences in
this array.

     ITEM turnover PACKED SIZE 8 OCCURS 12

(turnover is an array with 12 occurrences representing the turnover of
every month of a year.)

The REDEFINED Statement 

Any item in a record/item relationship may contain sub-items, meaning
that you can describe a parent/ child relationship.

With the REDEFINED statement you can specify the item as a sequence of
other items.

The REDEFINED statement consists of the keywords REDEFINED and BY,
followed by one or more ITEM statements and the final keyword, END.

      ITEM order-date  DATE-MD
       REDEFINED BY
        ITEM order-date-month
        ITEM order-date-day
       END

Order-date is a Date-type item, 4 Bytes in size, stored in the form
month/day.  The REDEFINED statement splits it into its components month 
and day, and the items ORDER-DATE-MONTH and ORDER-DATE-DAY are defined in
ELEMENT-statement strings of two characters or digits in length.

If the redefined item (parent item) is a key, its size must be equal to
the sum of the sizes of the sub-items (child items).  If the redefined
item (parent item) is not a key, its size must be equal to or longer than
that of the sub-items together (child items).


NOTE You cannot redefine items which are arrays with an occurrence of greater than one.
The BUILD Statement With the BUILD statement you give BRWGEND instructions to build the HP ALLBASE/BRW dictionary file, BRWDIC, from the dictionary source-file which you have generated, (in our examples, the GENDEF file). The BUILD statement is the last one in the process of generating the dictionary source file and consists only of the keyword BUILD. The BRWDIC can only be built if no error occurs during the analysis of the file containing the statements you created. The following page shows an illustration of the syntax of the dictionary source file that you generate.
[]
[]
Creating A BRWDIC Dictionary File With the User-Generated Dictionary Once you have generated the source file, you can create the HP ALLBASE/BRW dictionary file, BRWDIC. To create a BRWDIC with a User-Generated Dictionary 1. Run the BRWGEND program: : RUN BRWGEND.PUB.SYS 2. Respond to the following prompts: Name of Dictionary Specification File: Name of Print File : Use Redefined (Parent) Items (N/Y) : Use Names up to 20 Characters (Y/N) ? For the dictionary specification file, type the name of the file that contains the statements you defined: for example GENDEF. For the print file, type the name of the file to which you want BRWGEND to write any error messages or warnings. If you do not want BRWGEND to write the list to a file, press Return, and warnings and messages are printed to the screen. To use redefined (parent) items in the BRWDIC, type Y (yes) at the propmt. Type N (no), or press Return if you do not wish to include them. To use names with up to 20 characters, type Y or press Return for this prompt. Type N (no) if you want to use only names with a maximum length of 16 characters. If you use this option, names longer than 16 characters are truncated and checked to make sure that the truncated names are still unique. If you want to run reports with BRW/V, type N for no. BRW/V cannot use names longer than 16 characters. After analyzing the input, BRWGEND counts the number of errors and warnings found and prints that figure on the screen. * * * ERRORS 0 Warnings 0 END OF PROGRAM If the result of the error count is zero (0), BRWGEND creates the HP ALLBASE/BRW dictionary file BRWDIC. (The number of warnings is irrelevant.)


MPE/iX 5.0 Documentation