HP 3000 Manuals

KSAM Data File Definition and Creation [ HP ALLBASE/4GL Developer Self-Paced Training Guide ] MPE/iX 5.0 Documentation


HP ALLBASE/4GL Developer Self-Paced Training Guide

KSAM Data File Definition and Creation 

The data file you will create in this lesson is a KSAM file.  KSAM is an
abbreviation for "Keyed Sequential Access Method".  HP ALLBASE/4GL
includes a KSAM data manager that allows you to create and access KSAM
data files.

When you created the record layout in Lesson 2, you allocated a key
number to several fields on the records layout.  The KSAM file manager
uses the key fields to define the indexes for the file.  Key number 1 in
a record layout is called the primary key.

Task 1 - Defining a Data File 

Just as you had to define the field specifications before you could
create the physical fields, you have to follow the same process for data
files.  You first task is to define the characteristics of the file.

Using the Data File/SQL Table Definition Screen.   

You use this screen to specify the name of the file to be used in HP
ALLBASE/4GL, the name by which it is known to the host operating system,
and the record layout to be used for the file.  You can also enter a
brief description for documentation purposes.

To access the screen: 

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

   2.  Choose Database Items.

   3.  Choose Data File/SQL Table Definition.

[]
Data File/SQL Table Definition Screen Showing Window This screen uses three different windows. One window allows you to define KSAM and serial data files. The second window allows you to define HP ALLBASE/SQL tables. The third window allows you to define HP TurboIMAGE/iX data sets. Your entry in the File Type field determines which window is displayed. To enter the field values: Field Entry Explanation --------------------------------------------------------------------------------------- File Name product Internal name of the data file used by the application. File Type I Indicates the type of file interface to be used. Automatically displays KSAM window. Description. Enter a description.
[]
KSAM Window To enter values in the KSAM window: Field Entry Explanation -------------------------------------------------------------------------------------- External Name product (Accept Name of the file in the MPE/iX environment. default, if shown) By default this is the same name as the internal file name. A different name can be entered. Table 2-0. (cont.) Field Entry Explanation -------------------------------------------------------------------------------------- Default Record Accept the default. Indicates the record layout number to be used if no record name is specified in a file field reference. Also used to create the file. Record Layout List This is the header HP ALLBASE/4GL always builds the physical for the next 12 disk file records according to the default fields. You can record layout. enter the names of up to 12 different record layouts to be associated with this file. Record Layout List product_rcrd Name of the record layout to be associated - 1 with this file. Record Layout List Leave these fields - 2-12 blank. Notes on Window Entries. In addition to defining KSAM files, the other options for the File Type field allow you to define SQL base tables (S), fixed length record serial files (F), variable length record serial files (V), HP TurboIMAGE/iX automatic master data sets (A), HP TurboIMAGE/iX manual master sets (M), and HP TurboIMAGE/iX detail data sets (D). Refer to the HP ALLBASE/4GL Developer Reference Manual for more information about these file types. Using multiple record layouts in the file definition allocates a file buffer in memory (when the application is running) for each record layout assigned to the file. If you use multiple record layouts for a file, you can read more than one physical file record at the same time, or you can read the same physical record through different file buffers, allowing you to modify one buffer without destroying the contents of another. To complete and commit the screen: 1. Press the Commit Data function key to create the file definition. This is the logical file definition for use in HP ALLBASE/4GL. 2. Create the physical disk file. by pressing the Create File function key, or use the menus by pressing the Previous Menu function key and selecting Create File/SQL Table. The file/SQL table creation screen will be displayed. You are now ready to create the data file. Task 2 - Creating the Data File This is the second step in creating a data file. During this procedure the KSAM file manager is automatically invoked to create the physical files that are necessary to support the data file that you have defined. Using the File/SQL Table Screen. On this screen you enter the name of the data file that you defined in the last lesson. HP ALLBASE/4GL reads the file definition and displays the details so you can confirm your selections. You then create the physical file space. To access the screen from the main menu: 1. Select the Dictionary option. 2. Choose Database Items. 3. Choose Create File/SQL Table.
[]
Create File/SQL Table Screen The screen is shown as it will appear after you have completed all of the entries. To enter the field values: Field Entry Explanation --------------------------------------------------------------------------------------- File Name Accept the default of The name you used when you created the file product definition. This completes the data entry required on this screen. The remaining fields display the data you entered on the record layout screen. To create the file on disk: 1. Press Return to display the details of this file on the screen. The MPE/iX external file name is displayed first, followed by the key fields from the default record. Note that the two keys defined when you created the record definition are listed, along with an indicator specifying whether duplicate values are allowed. The description of the file is displayed in the lower portion of the screen. 2. Press the Commit Data function key to create the file on disk. When this process has completed, HP ALLBASE/4GL displays a message indicating that the file has been successfully created.


MPE/iX 5.0 Documentation