Previous Topic: Implementing Your Design with Non-SQLNext Topic: SQL Database Implementation for the Commonweather Corporation


Implementation Steps

  1. Decide on naming conventions for:
  2. Create the logical definition of your database using non-SQL schema and subschema statements.
  3. Create the database.

Each of these steps is described below.

Naming conventions

Database records and elements should have short, meaningful names. Record names are up to 16 characters in length. Elements within records can have names of up to 32 characters. Hyphens are usually used between tokens within a name (for example, SKILL-NAME).

Sets are typically named by concatenating the names of the two related records. This convention may need to be modified, however, since set names can be no more than 16 characters. For example, the set between the EMPLOYEE record and the DEPARTMENT record remains DEPT-EMPLOYEE.

Database definition

The following examples illustrate how the logical components of your design are translated into non-SQL schema statements. These statements are input to the schema compiler.

For complete DDL syntax, see CA IDMS Database Administration Guide.

ADD SCHEMA statement

A schema represents a logical group of records. Typically all records associated with a single database are defined within one schema.

The statement below defines the EMPSCHM schema.

ADD
SCHEMA NAME IS EMPSCHM VERSION 1   ◄------------- Names the schema

    SCHEMA DESCRIPTION IS 'COMMONWEATHER DATABASE'

    ASSIGN RECORD IDS FROM 1001 .

ADD AREA statement

Areas must be explicitly defined using the following statement.

ADD
AREA NAME IS EMP-DEMO-REGION   ◄-------------- Names the area

SUBAREA CALC-RANGE ◄-------------- Subarea name

SPACE  50 FROM  1  ◄-------------- Subarea page range

ADD RECORD statement

The definition of a record includes:

The statement below defines the record EMPLOYEE.

ADD
RECORD NAME IS JOB   ◄--------------------------- Names the record

    SHARE STRUCTURE OF RECORD JOB VERSION 1 ◄---- Uses description of record that has
                                                  already been defined through IDD
    RECORD ID IS AUTO     ◄---------------------- Instructs the system to assign
                                                  the record id
    LOCATION MODE IS CALC USING (JOB-ID)
       DUPLICATES ARE NOT ALLOWED

    MINIMUM ROOT LENGTH IS 24 CHARACTERS      ┐  Tells the system how to store
    MINIMUM FRAGMENT LENGTH IS 296 CHARACTERS ┘  fragments of this variable-length record

    CALL IDMSDCOM BEFORE STORE    ┐  Tells the system to compress the record
    CALL IDMSDCOM BEFORE MODIFY   │  during updates and decompress it for retrieval
    CALL IDMSDCOM AFTER GET       ┘  processing

    WITHIN AREA ORG-DEMO-REGION ◄---------------- Specifies the area name
    USING CALC-RANGE            ◄---------------- and subarea

ADD SET statement

To implement a linked relationship, you need to define a set. The definition of a set includes:

The statement below defines the EMP-COVERAGE set.

ADD
SET NAME IS EMP-COVERAGE

    ORDER IS FIRST  ◄-------------------- Tells the system to insert each new record
                                          immediately after the owner record in the set
    MODE IS CHAIN LINKED TO PRIOR ◄------ Tells the system that this is a chained set,
                                          not an indexed set and prior pointers are used
    OWNER IS EMPLOYEE
        NEXT DBKEY POSITION IS AUTO  ┐  Causes the schema compiler to assign pointer
        PRIOR DBKEY POSITION IS AUTO ┘  positions in the owner record automatically

    MEMBER IS HEALCOV
        NEXT DBKEY POSITION IS AUTO      ┐  Causes the schema compiler to assign
        PRIOR DBKEY POSITION IS AUTO     │  pointer positions in the member record
        LINKED TO OWNER                  │  automatically
            OWNER DBKEY POSITION IS AUTO ┘

        MANDATORY AUTOMATIC  ◄----------- Tells the system the membership option
                                          for the set

Subschema definition

Each subschema description for a database identifies the schema components that are available to a particular application program. Before a program containing logical record facility or navigational DML can be compiled, you must define at least one subschema.

To define a subschema, you submit the following types of statements to the subschema compiler:

A sample subschema listing for the Commonweather database is shown in Zoned and Packed Decimal Fields as IDMS Keys.

For further information on defining subschemas, see CA IDMS Database Administration Guide. For further information on defining a logical record subschema, see the CA IDMS Logical Record Facility Guide.

Creating the database

A database is represented by a segment. To create a database, you:

  1. Define the segment in the system dictionary using SEGMENT, FILE, and AREA statements.
  2. Include the segment definition in a DMCL and punch and link edit the DMCL to a load or core image library.
  3. Allocate the operating system files defined in the segment and initialize them using the FORMAT utility statement.

You are now ready to load data into your database.