Version 4.2.6 for Mainframes
 —  Database Management System Interfaces  —

NDB - General Information

This section covers the following topics:


Accessing a DB2 Table

Start of instruction set To be able to access a DB2 table with a Natural program

  1. Use the Natural Tools for DB2 to define a DB2 table.

  2. Use Predict or the SQL Services function of the Natural SYSDDM utility to create a Natural DDM of the defined DB2 table.

  3. Once you have defined a DDM for a DB2 table, you can access the data stored in this table by using a Natural program.

Natural for DB2 translates the statements of a Natural program into SQL statements.

Natural automatically provides for the preparation and execution of each statement. In dynamic mode, a statement is only prepared once (if possible) and can then be executed several times. For this purpose, Natural internally maintains a table of all prepared statements (see Statement Table in Internal Handling of Dynamic Statements).

Almost the full range of possibilities offered by the Natural programming language can be used for the development of Natural applications which access DB2 tables. For a number of Natural DML statements, however, there are certain restrictions and differences as far as their use with DB2 is concerned; see Natural DML Statements as described in Statements and System Variables. In the Natural Statements documentation, you can find notes on Natural usage with DB2 attached to the descriptions of the statements concerned.

As there is no DB2 equivalent to Adabas ISNs (Internal Sequence Numbers), any Natural features which use ISNs are not available when accessing DB2 tables with Natural.

For SQL databases, in addition to the Natural DML statements, Natural provides SQL statements as described in Statements and System Variables. In the Natural Statements documentation you can find a detailed description of these statements.

Top of page

Integration with Predict

Since Predict supports DB2, direct access to the DB2 catalog is possible via Predict and information from the DB2 catalog can be transferred to the Predict dictionary to be integrated with data definitions for other environments.

DB2 databases, tables and views can be incorporated and compared, new DB2 tables and views can be generated, and Natural DDMs can be generated and compared. All DB2-specific data types and the referential integrity of DB2 are supported. See the relevant Predict documentation for details.

In addition, the Predict active references support static SQL for DB2 as described in WITH XREF Option in Preparing Programs for Static Execution.

Top of page

Natural System Messages Related to DB2

The message number ranges of Natural system messages related to DB2 are 3275 - 3286, 3700-3749, and 7386-7395.

Top of page