Am 06.11.2021 um 03:16 schrieb Michael Potter:
Gnu Crew, We intend to support SQL code in COBOL/CICS code that we compile with OpenKicks.
Sounds good.
We are trying to compile code that originated on an IBM mainframe and accessed DB2. Our target will be Postgres.
In this case it is likely that you'll need to adjust some of the SQL parts and the connecting, but you are likely aware of the differences between DB2 and Postgres. Just to make it clear - it is a good move - but always calculate with additional necessary time - and best take an ESQL preprocessor that you _could_ tweak, if necessary.
Is there any good documentation for esql usage with GnuCOBOL? Any tips for us as we get started?
Make up your mind first if Postgres is the "fixed" target, in this case you can go with an ESQL preprocessor that uses postgres "directly". The "common" ESQL preprocessor that was used for this was https://github.com/opensourcecobol/Open-COBOL-ESQL/ - I do know of production environments which use that, but it seems quite unmaintained and has a bunch of "culprits" (starting with all DECLARE CURSOR have to be in the PROCEDURE DIVISION so you potentially have to adjust _every_ source). Then there's another free ESQL processor used in production "ESQL for GnuCOBOL/OpenCOBOL" written by Sergey Kashyrin found at https://sourceforge.net/p/gnucobol/contrib/HEAD/tree/trunk/esql/ (@Sergey: I think it would be really good to update that to the latest "3" version if that's stable now). It uses ODBC and targets a lot of different DB servers, not only Postgres and is also used in production. Note that because of the ODBC use "bad DB design / access" kicks back much more (especially lots of single reads can be much slower with the Postgres ODBC environment than when you use the Postgres library directly). It is still maintained by Sergey. You can find quite some information about that at https://gitlab.cobolworx.com/gnucobol/sql/ The last one which I'd likely try for new setups first is Gix-SQL which is a maintained heavy fork of Open-COBOL-ESQL. It is believed to have all "culprits" of the former solved. That one has one preprocessor but can target either Postgres, MySQL (both via their native libraries) or "any ODBC", for details see https://github.com/mridoni/gix/blob/main/doc/gixsql.md There's currently no "stand-alone release" so you'd either need to build it on your own or take the complete Gix-IDE and then only use the Gix-SQL part of it. The last announcement of Gix-IDE is at https://sourceforge.net/p/gnucobol/discussion/contrib/thread/a0e877f053 which also includes a roadmap which has "stand-alone release of Gix-SQL) in it. No matter which route you follow it would be nice to get an "update" to this list when you've progressed further to allow people learn from your experiences or about your considerations. Happy hacking, Simon