Accessing a DB2 Table

Beginn der Anweisungsliste To enable access to a DB2 table with a Natural program

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

  2. Use Predict or the SQL Services function of the Natural SYSDDM utility to create a Natural data definition module (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 Using Natural Native DML Statements as described in Using Natural Statements and System Variables.

In the Natural Statements documentation, you can find notes on Natural usage with DB2 attached to the descriptions of the Natural DML statements concerned; see the Statements Overview.

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

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