HP 3000 Manuals

Dictionary Requirements [ HP ALLBASE/4GL Developer Self-Paced Training Guide ] MPE/iX 5.0 Documentation


HP ALLBASE/4GL Developer Self-Paced Training Guide

Dictionary Requirements 

The first task is to create the files used by this system.  This involves
creating the field specifications, record layouts, and data files.  The
file and fields you need are shown below:

   *   An option file with the following fields:

              - option_key (not necessary for HP ALLBASE/SQL based
              applications)

              - product_no

              - option_no

              - description

              - cost

              - quantity

              - unit_measure

Task 1 - Creating Dictionary Field Specifications 

The first items you must create are the dictionary field specifications.
Most of these field specifications already exist from the previous work
you have done, so you won't need to create the product_no, description,
cost, quantity, or unit_measure fields.

   1.  If you are creating the KSAM based or HP TurboIMAGE/iX based
       application, create both of the specifications described below.

   2.  If you are creating the HP ALLBASE/SQL based application, only
       create the first of these specifications.

          a.  Option Number.  A three digit option specifier.  A unique
              value within any given product.

              Field Spec Name     option_no
              Field Length        3
              Edit Code           N
              Storage Type        C
              Pad Character       0

          b.  Option Key.  A concatenation of the product number and
              option number forming a unique key to the option data file.
              You cannot actually specify the concatenation when you
              define the field specification.  Later, you will create
              some logic that links the product number and option number
              fields, and sends the output to the option_key field
              specification.

              Field Spec Name     option_key
              Field Length        9
              Minimum Entry       9
              Length
              Edit Code           U

When you have created these dictionary field specifications you can
create the record layout and the option file.

Task 2 - Creating the Record Layout and File 

If you are developing the KSAM based application, continue reading below.

If you are developing the HP ALLBASE/SQL based application, turn to the
instructions for creating ALLBASE/SQL based record layouts.

If you are developing the HP TurboIMAGE/iX based application, turn to the
instructions for HP TurboIMAGE/iX Based Applications.

To create KSAM Based record layout: 

   1.  Create the following record layout.

   2.  Remember to generate the layout once you have defined it.

          a.  Option record.  This record contains the seven fields
              needed to store and retrieve each option item.

              Record Layout Name.  option

 Field   Field Spec.Name              Key #      Duplicates 
   1     option_key                     1            N
   2     product_no                     2            Y
   3     option_no                      3            Y
   4     description
   5     cost
   6     quantity
   7     unit_measure

              You can now create the option data file.

          b.  Option File. 

              The option file contains all the option records.  Create
              the file definition, using the details below, and then use
              the file creation screen to create the physical file.

              File Name           option
              File Type           I
              External Name       option
              Default Record      1
              Record Layout       option

You have now completed all the records and files required for this
application.  Turn to Variables to continue developing your application.

To create HP ALLBASE/SQL based record layouts: 

   1.  Create the following record layout.

   2.  Remember to generate the layout once you have defined it.

          a.  Option record.  This record contains the six fields needed
              to store and retrieve each option item.

              Record Layout Name.  option

 Field   Field Spec.Name              Key #      Duplicates 
   1     product_no
   2     option_no
   3     description
   4     cost
   5     quantity
   6     unit_measure

              You can now create the option table.

          b.  Option Table. 

              The option table contains all the option records.

              Create the table definition according to the following
              definition and then use the file creation screen to create
              the physical table.

              File Name           option

              File Type           S

              External Name       OPTION

              SQL DBEfileset      OPTFS

              SQL Access Class    1

              Record Layout       option

You have now completed all the records and files required for this
application.  Turn to Variables, to continue developing your application.

To create the HP TurboIMAGE/iX based record layout: 

For the HP TurboIMAGE/iX based application, you will define the option 
data set, which contains all the details about each option for a product.

The HP TurboIMAGE/iX database traindb created by your HP HP ALLBASE/4GL
or HP TurboIMAGE/iX administrator also contains automatic master data
sets which act as indexes to the option_key and option_no key field
specifications.  You won't need to define these automatic master data
sets in HP ALLBASE/4GL as you do not use them directly in HP ALLBASE/4GL
logic.  The HP TurboIMAGE/iX database also specifies that the product_no 
field is linked to the manual master data set product.

   1.  Create the following record layout.

   2.  Remember to generate the layout once you have defined it.

          a.  Option record.  This record contains the seven fields
              needed to store and retrieve each option item.

              Record Layout Name.  option

 Field   Field Spec.Name              Key #      Duplicates 
   1     option_key                     1            N
   2     product_no                     2            Y
   3     option_no                      3            Y
   4     description
   5     cost
   6     quantity
   7     unit_measure

              You can now define the option data set.

          b.  Option File. 

              The option file contains all the option records.  Create
              the file definition now.

              File Name           option
              File Type           D
              Database Name       traindb
              Schema Data Set     OPTION
              Name
              Default Record      1
              Record Layout       option

You have now completed all the records and files required for this
application.

Task 3 - Creating Variables 

This part of the application requires three additional variables for KSAM
based and HP TurboIMAGE/iX based applications, and four additional
variables for HP ALLBASE/SQL based applications.  The variables are
described below.

   1.  Create each variable now.

          a.  confirm.  This variable is used to receive confirmation
              from the user for a deletion request.  The Q edit code is a
              special Query code which allows the entry of Y, y, N, or n 
              only.

              Name                confirm
              Length              1
              Edit Code           Q

          b.  current_record.  Indicates the current record type, which
              is either product or option.

              Name                current_record
              Length              3
              Edit Code           X

          c.  option_status.  Indicates whether the current option record
              exists.

              Name                option_status
              Length              1
              Edit Code           X

              If you are developing the HP ALLBASE/SQL based application,
              create the following variable.  If you are not developing
              the HP ALLBASE/SQL based application, continue reading from
              the Alphanumeric Constants section below.

          d.  option_no.  Contains the option_no currently displayed on
              the option window.

              Name                option_no
              Length              3
              Edit Code           N

Task 4 - Creating Alphanumeric Constants 

Two alphanumeric constants are required for the application.  They are
described below.

   1.  Create both of these constants now.

          a.  option.  An indicator of the current record.

              Name                option
              Value               opt

          b.  product.  An indicator of the current record.

              Name                product
              Value               prd

Task 5 - Creating Numeric Constants 

For KSAM based applications, this application requires two more
additional numeric constants.

For HP ALLBASE/SQL based applications, only the zero numeric constant is
required.

For HP TurboIMAGE/iX based applications, this application requires three
more additional numeric constants.

   1.  Create the constants necessary for your application.

          a.  All Applications 

              Name                zero
              Value               000

              This numeric constant is the value of the first option
              number for each product.  The constant is used to test for
              the first option.

          b.  KSAM Based and HP TurboIMAGE/iX Based Applications 

              Numeric Constant - end_of_file. 

              Name                end_of_file
              Value               19110

              The value of this numeric constant is the file error value
              returned by the KSAM data manager if a FILE *NEXT command
              encounters the end or beginning of a file.  In this
              application it is used to test the file return status
              value.

          c.  HP TurboIMAGE/iX Based Applications 

              Name                end_of_chain
              Value               19115

              This numeric constant is the file error value returned by
              the HP TurboIMAGE/iX data manager is a FILE *NEXT command
              encounters the end or beginning of a chain of linked detail
              data set records.  The constant is used to test the file
              return status value.

You have now completed defining all of the constants and variables
required by the application.

Task 6 - Creating Validation Tables 

The last dictionary item needed to support the field specifications and
files is the unit validation table.  You haven't used validation tables
yet so it's described in full.

Menu Path 

To access the Validation Tables Screen 

   1.  From the main menu, select the Dictionary option.

   2.  Select the Validation Items option.

   3.  Choose Tables.

Screen Description 

A validation table is used in a similar manner to a validation range.  A
table contains a number of discrete values that are acceptable values in
a field.

A validation table is a table containing up to 51 values.

When you associate a validation table with a screen field, HP ALLBASE/4GL
automatically tests the data entered by the user against the values in
the table when data entry is complete.  If the value entered exists in
the table, processing continues normally.

If the entered value does not exist in the table, HP ALLBASE/4GL displays
the message associated with the table.  Processing then continues in
accordance with the type of message.  If you don't define a message in
association with the table, HP ALLBASE/4GL displays a system defined
ERROR type message by default.


NOTE In some cases you may need to validate input data against more than 51 values. You can use the CHECK logic command in an after function on the field to validate the entered data against a number of tables. Refer to the HP HP ALLBASE/4GL Developer Reference Manual for further information on the CHECK command.
[]
Validation Tables Screen To enter the field values: Field Entry Explanation --------------------------------------------------------------------------------------- Table Name unit This is the name of the table within the application. Secured Accept the default. This designates whether this item is secured against an unauthorized developer changing the entry. Message Name unit_error This is the name of the message that is displayed if the value entered by the user does not match any of the values in the table. You will define this message soon. Table Values Enter the following The meanings of the abbreviations are abbreviations. listed only for information. g gram ml milliliter kg kilogram l liter m meter ton ton m2 square meter gal gallon m3 cubic meter oz ounce in inch lb pound ft foot cb cubit yd yard unit single unit You can add some other values if you wish. 1. Press the Commit Data function key to create the table. 2. When you have committed the table, include it in the field specification by performing the following steps. Action Explanation Press Field This displays the field specification screen. Specs. Enter unit_measure This is the name of the field specification that has to be altered. Tab to the Table This is the field where you enter the name of field the validation table. Enter unit This is the name of the validation table. Press Commit Data This creates the new field specification. 3. Now go to the screen field details screen and call up the mb_order screen (which was created by the module builder). 4. Call up field number 6 and you will see that the new detail for the field specification has been included automatically. 5. Press the Generate Screen function key to incorporate the new table for the field specification in the application. Message - unit_error The last thing you need to do is to create the unit_error message. 1. Go to the message definition screen. 2. If you haven't defined any other messages, tables, or ranges since you defined the validation table, the message name should default to unit_error. If it doesn't, enter the correct name. 3. Assign the message an ERROR type code and enter a message to inform the user that the unit of measure just entered is invalid. 4. Then commit the message to generate it. All of the additional dictionary items for this part of the application are complete.


MPE/iX 5.0 Documentation