Version 4.2.6 for Mainframes
 —  Database Management System Interfaces  —

General Information

This section covers the following topics:


Introduction to Natural SQL Gateway

Purpose and Usage

With Natural SQL Gateway, a Natural user residing on z/OS can access data in an SQL database residing either on a UNIX or a Windows system.

In general, there is no difference between using Natural with an SQL database and using it with Adabas, VSAM or DL/I. Natural SQL Gateway allows Natural programs to access SQL data, using the same Natural DML statements that are available for Adabas, VSAM, and DL/I.

Therefore, programs written for SQL tables can also be used to access Adabas, VSAM, or DL/I databases. Moreover, some additional Natural SQL statements are available.

Product Structure

Natural SQL Gateway is comprised of the following parts:

The z/OS section in the figure above differs depending on whether the SQL program runs in Batch/TSO or within a TP environment.

SQL Program Running under Batch/TSO

The following figure shows the constellation under Batch/TSO.

The ConnecX Client (namely API3GL) is directly linked to the Natural SQL program.

SQL Program Running in a TP Environment

The following figure shows the constellation if the SQL program runs within a TP environment.

Since the ConnecX Client is not capable to run in a TP environment, it is moved into the Natural SQL Gateway server process, which runs in a batch environment. The Natural SQL Gateway Client and the Natural SQL Gateway server are responsible for transmitting the SQL requests from the Natural program to the JDBC server and the results backward.

Explanation of Terms Used in this Documentation

The following table provides an overview of important terms used in the Natural SQL Gateway documentation:

Term Explanation
NSB This is the product code of Natural SQL Gateway, often used as short name in this documentation.
NSERV Short for Natural SQL Gateway server.
File Server The term "file server" refers to the Natural file server.
DB2 DB2 refers to the family of IBM's licensed programs for relational database management.

Top of page

Accessing an SQL Table

Start of instruction setTo be able to access an SQL table with a Natural program via Natural SQL Gateway

  1. A connection to the ConnecX SQL Engine JDBC server has to be established and a ConnecX SQL Engine data dictionary (CDD) has to be deployed.

  2. The CDD has to contain the definition of the SQL table to be accessed

  3. A DDM describing the SQL table has to be created with the Natural utility SYSDDM.

    The DBID of the DDM has to be defined as database type SQL via NTDB macro in the NATPARM module.

  4. The DBID of the DDM has to be defined as database type CNX via NDBID macro in the NDBPARM module. The SQL table to be accessed has to be defined in the CDD, see also the ConnecX SQL Engine Data Dictionary documentation.

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

The Natural SQL Gateway translates the statements of a Natural program into SQL statements.

Natural SQL Gateway automatically provides for the preparation and execution of each statement in dynamic mode. Static execution is currently not supported. 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 SQL tables. For a number of Natural DML statements, however, there are certain restrictions and differences as far as their use with SQL 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 SQL attached to the descriptions of the statements concerned.

As there is no SQL equivalent to Adabas ISNs (Internal Sequence Numbers), any Natural features which use ISNs are not available when accessing SQL 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

Natural System Messages Related to NSB

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

Top of page