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:
To compile a program with GnuCOBOL:
Create a directory to contain your COBOL code and place your COBOL scripts and programs in this directory.
Copy the ADAGLOB.txt file, which you modified during the installation steps, to this directory.
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.
To execute the compiled program:
Specify the Adabas database ID with the SQL_DEFAULT_DBID
environment
option.
Execute the program.
./program
To compile a program with Raincode COBOL:
Create a directory to contain your COBOL code.
Copy the ADAGLOB.txt file, which you modified during the installation steps, to this directory.
Copy the /Raincode
directory from the examples directory to this
directory.
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.
To execute the compiled program:
Specify the Adabas database ID with the SQL_DEFAULT_DBID
environment
option.
Type to rclrun ScriptName.dll
execute the
program.
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.
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:
Type M
after Function for Maintenance
, type
RL
after Object Type
, and press
to go to the next panel.
Type A
after Function
to add a file relation, type
EMPL
as the File relation ID
, and press
to go to the next panel.
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
).
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.
To execute the compiled program:
Specify the appropriate Adabas database ID with the SQL_DEFAULT_DBID
environment option.
If using GnuCOBOL, execute the program.
./program
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