Creating DDMs

This section describes how to create a DDM by either copying DDMs or creating DDMs directly from the field definitions in a database. In addition, it provides information on how to generate multiple DDMs from an SQL database.

This section covers the following topics:


Copying DDMs

This section describes how to create a new DDM from an existing one.

Start of instruction setTo copy a DDM

  1. From a DDMs node or subnode, choose a DDM and open the object.

    The DDM editor is invoked with the DDM source displayed in the editing area.

  2. From the Object menu, choose Save As.

    The Save As dialog box appears.

  3. In the Name text box, enter a new DDM name and, in the Libraries combo box, select a library if required.

    The new DDM is saved as a source object and is added to the corresponding DDMs node or subnode.

  4. From the Object menu, choose Stow to save the new DDM as a cataloged object. See also Saving and Cataloging a DDM.

You can also copy single or multiple objects by using the copy-and-paste or drag-and-drop feature of Natural Studio as described in Copying Objects in Natural Studio documentation.

If you want to copy DDMs between different libraries, database files, and/or hardware platforms, see also Maintaining DDMs in Different Environments.

Creating DDMs from Adabas

Start of instruction setTo create a DDM from an Adabas database

  1. Select the DDMs node or subnode or log on to the library where you want to create the DDM.

  2. From the Object menu, choose New > DDM.

    Or:
    Choose the New DDM toolbar button.

    The New DDM - Select Database dialog box appears as shown in the example below:

  3. Select an Adabas database. The DBID (database ID) and database type are then shown in the corresponding DBID and Type boxes.

    Or:
    In the DBID text box, enter a numeric value in the range from 0 to 65535 (except 255).

    If you enter a 0 (zero), the database ID specified with the Natural profile parameter UDB (see the Parameter Reference documentation) of the Natural parameter file NATPARM is used.

    If you enter a DBID that is not yet contained in the list box, from the Type combo box, select Adabas if required.

  4. Choose OK.

    If the specified DBID identifies an Adabas database, the New Adabas DDM dialog box appears as shown in the example below:

  5. In the File number text box, enter a numeric value in the range from 1 to 5000 and choose OK.

    If the specified database and the file are available, the DDM editor is invoked and the fields contained in that database file are read into the editing area.

    If the specified database is not active or cannot be accessed or if the file does not exist, a corresponding error message is issued. Nevertheless, if you press ENTER, you can still open an empty DDM editor screen, enter new field attribute definitions and save the DDM source. However, in this case you cannot check any definitions against the database file description.

  6. If required, edit the DDM source: see the section Using the DDM Editor.

  7. After editing, from the Object menu, choose Stow and, in the Stow As dialog box, enter the name of the new DDM.

    The syntax of the DDM source is checked and the DDM is saved as a source and a cataloged object. See also Saving and Cataloging a DDM.

Creating DDMs from SQL

Start of instruction setTo create a DDM from an SQL database

  1. Select the DDMs node or subnode or log on to the library where you want to create the DDM.

  2. From the Object menu, choose New > DDM.

    Or:
    Choose the New DDM toolbar button.

    The New DDM - Select Database dialog box similar to the example below appears:

  3. Select an SQL database. The DBID (database ID) and database type are then shown in the corresponding DBID and Type boxes.

    Or:
    In the DBID text box, enter a numeric value in the range from 0 to 65535 (except 255).

    If you enter a 0 (zero), the database ID specified with the Natural profile parameter UDB (see the Parameter Reference documentation) of the Natural parameter file NATPARM is used.

    If you enter a DBID that is not yet contained in the list box, from the Type combo box, select SQL if required.

  4. Choose OK.

    If the specified DBID identifies an SQL database, the New SQL DDM dialog box appears as shown in the example below:

    Select the SQL table for which a DDM is to be created:

    • To list all SQL tables for selection, use the asterisks (*) in the text boxes Table owner and Table name. The asterisks (*) are entered by default.

    • To list a particular range of SQL tables, use asterisk (*) notation, for example, AB* selects all SQL tables with names that start with AB.

  5. Choose OK.

    The Select SQL Table list box appears with the selection list of SQL tables specified in Step 4 as shown in the example below:

  6. From the list box, select the required SQL table and choose OK.

    Depending on your SQL database settings, the Database Logon window appears if you access this SQL database for the first time in this session. Enter the user ID and the password specified for the database and choose OK.

    If the specified database and the file are available, the DDM editor is invoked and the SQL table selected is read into the editing area. A name is generated automatically for the DDM. It is a combination of the table owner and the table name and cannot be changed. For example, if the table owner's name is SAG and the table name is TEST, the DDM name is SAG-TEST.

    If the specified database is not active or cannot be accessed or if the file does not exist, a corresponding error message is issued. Nevertheless, if you press ENTER, you can still open an empty DDM editor screen, enter new field attribute definitions and save the DDM source. However, in this case you cannot check any definitions against the database file description.

  7. If required, edit the DDM source: see the section Using the DDM Editor.

  8. After editing, from the Object menu, choose Stow and, in the Stow As dialog box, enter the name of the new DDM.

    The syntax of the DDM source is checked and the DDM is saved as a source and a cataloged object. See also Saving and Cataloging a DDM.

Creating Multiple DDMs from SQL

The following section only applies to a local environment.

The Natural program DDMGEN (supplied in the Natural system library SYSTEM) provides the option to generate multiple DDMs simultaneously from SQL tables without using the DDM editor.

Start of instruction setTo execute DDMGEN

  1. In the command line of Natural Studio, enter the following:

    DDMGEN

    The SQL DDM Generation screen appears where you can fill the fields required to generate a DDM from an SQL table as demonstrated in the example below:

     SQL DDM Generation     
     ==================     
                            
     DDM Library  : DDMTEST 
     DDM DBID     : 210     
     Table Owner  : QA*     
     Table Name   : *       
     Replace (Y/N): N       
    

    Enter the name of the library where you want to create the DDMs and enter the name of a table and/or specify a range as described in the previous section.

  2. Press ENTER to execute the program.

    Status messages appear at the bottom of the screen that indicate which DDM is generated from which SQL table. The DDMs generated are saved as source and cataloged objects in the specified library.

Creating DDMs from Tamino

Only applies to a local Windows environment, or a remote environment on a Windows, a UNIX or an OpenVMS platform.

Start of instruction setTo create a new DDM from a Tamino database

  1. Select the DDMs node or subnode or log on to the library where you want to create the DDM.

  2. From the Object menu, choose New > DDM.

    Or:
    Choose the New DDM toolbar button.

    The New DDM - Select Database dialog box appears as shown in the example below:

  3. Select an XML database. The DBID (database ID) and database type are then shown in the corresponding DBID and Type boxes.

    The file number (FNR) of the DDM is always 1. The file number cannot be modified.

    Or:
    In the DBID text box, enter a numeric value in the range from 0 to 65535 (except 255).

    If you enter a 0 (zero), the database ID specified with the Natural profile parameter UDB (see the Parameter Reference documentation) of the Natural parameter file NATPARM is used.

    If you enter a DBID that is not yet contained in the list box, from the Type combo box, select XML if required.

  4. Choose OK.

    If the specified DBID identifies a Tamino database, the Select Doctype window appears with a list of available doctypes as shown in the example below:

  5. From the list, select a doctype and choose OK.

    If you are accessing this Tamino database for the first time in this session, the Database Logon window appears. Enter the user ID and password for the database and choose OK.

    The DDM editor is invoked and the DDM generated from the selected doctype is read into the editing area.

  6. If required, edit the DDM source: see the section Using the DDM Editor.

  7. After editing, from the Object menu, choose Stow and, in the Stow As dialog box, enter the name of the new DDM.

    The syntax of the DDM source is checked and the DDM is saved as a source and a cataloged object. See also Saving and Cataloging a DDM.

Creating DDMs for VSAM

Only applies to a remote environment on a mainframe platform.

DDMs for VSAM files are not generated by Natural. Therefore, instead of selecting VSAM file definitions from a list, you enter DDM field attribute definitions directly in the editing area by using the New option of the Object menu.