Using Adabas Native SQL

Before you use Adabas Native SQL, verify that you have installed and configured the product correctly.

With Adabas Native SQL for Linux, you can convert your existing COBOL scripts previously used on the mainframe to create executable code to run under Linux operating systems. The name of the compiled executable and the Adabas Native SQL script differ depending on which third-party compiler you use on your Linux system.

The sagenv.new script, located in the Software AG installation directory/bin directory enables the environment necessary for Adabas Native SQL to run.

Note:
Transfer any mainframe scripts you want to the local machine in ASCII format and with .cob file extension.

This document covers the following topics:


Compiling with GnuCOBOL

Start of instruction setTo compile a program with GnuCOBOL:

  1. Create a directory to contain your COBOL code and place your COBOL scripts and programs in this directory.

  2. Copy the ADAGLOB.txt file, which you modified during the installation steps, to this directory.

  3. In the COBOL scripts directory you created, type gsqlcomp.sh ./ScriptName

    This script invokes the GnuCOBOL compiler and produces an executable program in the local directory with the same name as your COBOL script without an extension.

Compilation errors are either printed in the console or logged in the ADAMES.txt file, located in the current direcotry.

Start of instruction setTo execute the compiled program:

  1. Specify the Adabas database ID with the SQL_DEFAULT_DBID environment option.

  2. Execute the program.

    ./program

Compiling with Raincode COBOL

Start of instruction setTo compile a program with Raincode COBOL:

  1. Create a directory to contain your COBOL code.

  2. Copy the ADAGLOB.txt file, which you modified during the installation steps, to this directory.

  3. Copy the /Raincode directory from the examples directory to this directory.

  4. In the COBOL scripts directory you created, type rsqlcomp.sh ./ScriptName

    This script invokes the Raincode COBOL compiler and creates a new directory called /Raincode_ScriptName. The compiler produces an executable program in the new directory with the same name as your COBOL script with a .dll extension.

Compilation errors are either printed in the console or logged in the ADAMES.txt file, located in the current direcotry.

Start of instruction setTo execute the compiled program:

  1. Specify the Adabas database ID with the SQL_DEFAULT_DBID environment option.

  2. Type to rclrun ScriptName.dll execute the program.

Working with the Example Files

The /examples directory contains three example programs, a sample global configuration file (ADAGLOB.txt), and the /Raincode directory that the Raincode compiler uses. You can use the example programs to verify the program and environment are correctly set up to use Adabas Native SQL for the installation.

Viewing these files in a text editor gives you an idea of what each does. Note that two of the example programs (CEX2.cob and CEX3.cob) actually modify the example data in Adabas.

Load Adabas and Predict Example Data

The example programs are designed to work with the EMPLOYEES and VEHICLES Adabas example files. These files must be loaded into your Adabas target database ID.

Note:
The EMPLOYEES file is delivered in the Adabas for Linux, UNIX and Windows installation examples under the name EMPLOYEES-NAT.

Your Predict data dictionary file (FDIC) must contain the example dictionary data for these files.

If the database containing these files is remote, you must have Entire Net-Work Client installed to access the remote database.

The example programs utilize the relation between identical fields in the two example files. In order to compile the example programs, you must create a soft-couple relation between the two files in Predict. To establish this file relation, use the Natural SYSDIC library and perform the following:

  1. Type M after Function for Maintenance, type RL after Object Type, and press Enter to go to the next panel.

  2. Type A after Function to add a file relation, type EMPL as the File relation ID, and press Enter to go to the next panel.

  3. Type S for adding a soft-couple relation type, then enter File 1, File ID (e.g. EMPLOYEES, PERSONNEL-ID). Then, enter File 2, File ID (e.g VEHICLES, PERSONNEL-ID).

Compile the Program

If using the GnuCOBOL compiler, type the following to compile en example program:

gsqlcomp.sh ./program.cob

If using the Raincode COBOL compiler, type the following to compile en example program:

rsqlcomp.sh ./program.cob

Compilation errors are either printed in the console or logged in the ADAMES.txt file, located in the current direcotry.

Execute the Program

To execute the compiled program:

  1. Specify the appropriate Adabas database ID with the SQL_DEFAULT_DBID environment option.

  2. If using GnuCOBOL, execute the program.

    ./program
  3. If using the Raincode COBOL compiler, navigate to the directory created during the compilation and locate the executale .dll file. Execute the program.

    rclrun ./program.dll