Difference between revisions of "GixSQL"

From PostgreSQL_wiki
Jump to: navigation, search
(gixsql precompilation)
(Sample Program)
 
(4 intermediate revisions by the same user not shown)
Line 30: Line 30:
 
The command invoking the precompile process is as follows:<br/>
 
The command invoking the precompile process is as follows:<br/>
   
/usr/bin/gixsql cobolpostgresql.cbl cobolpostgresql.cbsql -S -I. -e ".,*.cpy,*.CPY"<br />
+
/usr/bin/gixsql cobolpostgresql.cbl cobolpostgresql.cbsql -S -I. -e ".,*.cpy,*.CPY"<br />
   
 
The input file is cobolpostgresql.cbl, the output file is cobolpostgresql.cbsql.
 
The input file is cobolpostgresql.cbl, the output file is cobolpostgresql.cbsql.
Line 42: Line 42:
   
 
== Sample Program ==
 
== Sample Program ==
The sample program makes use of the sample database: [[employee database]].
+
The sample program makes use of the sample database: [[cobolpostgresql].cbl].
   
 
== Sample database ==
 
== Sample database ==
Line 50: Line 50:
 
The python script [[gixc.py]] implements the GixSQL Cobol compilation workflow. It is invoked with a single parameter, being the program_name suffixed by either 'cbl or 'cob'.
 
The python script [[gixc.py]] implements the GixSQL Cobol compilation workflow. It is invoked with a single parameter, being the program_name suffixed by either 'cbl or 'cob'.
 
<hr/>
 
<hr/>
Back to: [[GixSQL]]
+
Back to: [[voorpagina]]

Latest revision as of 17:00, 6 November 2025

GixSQL is a way in which Cobol programs are able to use modern database management systems in a Linux environment. A setup with a Cobol PostgreSQL program and a simple compilation workflow are below.

Cobol

Cobol has been around for more than 60 years and will stay around for the foreseeable future, estimates are that there are about 800 billion lines of Business Cobol code around. The programs are heavily used, servicing about 80% of all financial and business transaction.
The reason behind this endurance lies in the fact that Cobol is a standardised language, a program written in 1974 can be compiled today with a modern compiler. The resulting executable program still runs today, without the need of adaptation.
Traditionally Cobol programs have their application in big business mainframe environments. These large enterprises, however, are shifting more and more of their applications to the Linux platform. The broad adoption of Linux in the enterprise environment started around 2010. So, it is no wonder that Cobol gradually is being made available for the Linux platform, enter GNUCobol.

GNUCobol

Is an Open Source Cobol compiler, the project originally started in 2002 [ https://en.wikipedia.org/wiki/GnuCOBOL GNUCobol ] as OpenCobol. GNUCobol is now a full blown Cobol compiler.

PostgreSQL and Cobol

PostgreSQL is getting more and more traction around the world, also in the big enterprises. Big enterprises have ample reason to stick to their Cobol program stack, in which they invested huge amounts of money. So if PostgreSQL is to make it to the business applications of the big enterprises, it has to find a way to interact in a reliable manner with Cobol. Enter the GixSQL SQL preprocessor for Cobol.

Practical introduction to GiSQL

This chapter contains guidance to set up a working GixSQL for PostgreSQL development environment.

Prerequisites

  • Debian 12
  • GnuCobol4
  • libmariadb-dev libmariadb-dev-compat libpq5 unixodbc libfmt9
  • GixSQL
  • optionally the PostgreSQL database server on the same machine.

You obtain GixSQL here; GixSQL. Just install the software in the sequence above and the system is ready to go.

Workflow

Once the editing of the program is finished, the program has to be compiled. This is done in various steps, but this can also be done by using the Python script below.
The steps are:

  1. The precompile process
  2. Inspect (but do not edit the output)
  3. The compilation process
  4. Inspect the compilation listing
  5. Run the program

gixsql precompilation

The command invoking the precompile process is as follows:

/usr/bin/gixsql cobolpostgresql.cbl cobolpostgresql.cbsql -S -I. -e ".,*.cpy,*.CPY"

The input file is cobolpostgresql.cbl, the output file is cobolpostgresql.cbsql.

The cobc GNUCobol compilation

The command invoking the precompile process is as follows:

/usr/bin/cobc -x cobolpostgresql.cbsql -l:libgixsql.so -T cobolpostgresql.out

This results in the executable program file cobolpostgresql.

Sample Program

The sample program makes use of the sample database: [[cobolpostgresql].cbl].

Sample database

The employee database is a very simple database, with one table containing three lines. The pg_dump file is in the link.

Simple Workflow script

The python script gixc.py implements the GixSQL Cobol compilation workflow. It is invoked with a single parameter, being the program_name suffixed by either 'cbl or 'cob'.


Back to: voorpagina