Great that may well save me changing the presql2 (JC compiler) to
support standard SQL requests soon but will have to at some point as I
want to make it multi talented. [ mysql, postgres, db2, oracle, et al ]
Vince
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
but i have no clue if i support every feature of free format, at least dbpre generates coding, which can be compiled with cobc -free without errors and the binary is running and doing what it should do.
Going finally to work on cobmysqlapi.c tomorrow or so, its just the Windows stuff missing, that shouldnt be a big thing.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
That look good I will grab it when you have finished.
I did look at dbpre and the JC pre-processor when programming my DAL
(Data Access Layer) units for ACAS and these handle the processing in
place for read, write, open, close etc for file handling.
The plus for yours was standard SQL but the JC one has some features
that as a programmer I found time saving.
The JC tool does NOT use standard EXEC SQL statements but extended type
but does simplify some of the elements that are not in the standard SQL
as near as I can tell.
Will still like to try it even if I have to add some more functions to
cover the differences.
In any event I will need to put in support for reading a $SET SQL XYZ
cobol source line to work out what process is being requested where xyz
= MYSQL | MARIA, DB2, POSTGRES, ORACLE etc.
After all it is 'mostly' just a case of changing the CALL routines --
famous last words :)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In any event I will need to put in support for reading a $SET SQL XYZ
cobol source line to work out what process is being requested where xyz
= MYSQL | MARIA, DB2, POSTGRES, ORACLE etc.
After all it is 'mostly' just a case of changing the CALL routines --
famous last words :)
Exactly, you named it. Just change the CALL's* :P
Technically spoken, its not a problem to add support for DB2, Postgres, ORACLE, whatever.
But i am not a DB admin who knows how to use all those DB systems, so, if thats a request, i need some help to add support for those DB's to dbpre.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Some code will also with SQL often be specially crafted to the sql dialect. This is the reason that Vincent asked for supporting conditional compilation (a plain $IF xyz + $IF xyz = literal / >> IF xyz DEFINED + >> IF xyz = literal should be enough for this). A possible solution may be:
C:\GnuCobol-3.1\bin/ld.exe: C:\Program Files\MySQL\MySQL Server 8.0\lib/mysqlclient.lib(libssl-1_1-x64.dll): Recognised but unhandled machine type (0x8664) in Import Library Format archive
cobmysqlapi.o:cobmysqlapi.c:(.text+0x52d): undefined reference to mysql_errno@4'
cobmysqlapi.o:cobmysqlapi.c:(.text+0x559): undefined reference tomysql_error@4'
cobmysqlapi.o:cobmysqlapi.c:(.text+0x587): undefined reference to mysql_errno@4'
cobmysqlapi.o:cobmysqlapi.c:(.text+0x5b4): undefined reference tomysql_error@4'
...
Any clues what that might be?
Last edit: The_Piper 2020-08-26
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am working right now on a new distribution, all files stored in separate directories like src, examples, doc and such and writing a users guide.pdf/odt.
I am going to post here a link to a zip file with all that stuff i want to release to sourceforge soon, so you, @vcoen and @Alan can test it (and maybe do some proof reading of the users guide).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Got the updates and will test shortly but after Wednesday as have to go to Hospital for a procedure on Wed with prep Tuesday so unlikely to feel up to it.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Any ideas what the problem might be?
A missing option for cobc maybe to specify the machine type?
That's nothing about cobc but the linker. It sees a x86_64 import library an you likely have used Arnold's 32bit MinGW build. Either use the MSYS2 64bit based one (or install MSYS2 and within via pacman -S gnucobol GnuCOBOL) or use a 32bit version of the MySQL client (server can stay 64bit and you possibly already have the 32bit client somewhere, too).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
As Simon says, the error message means the linker found a library it needs but can't use. The compiled code is 32-bit, but the library (probably the MySQL client library) is 64-bit.
To confirm, run dumpbin /headers on the library. You can use verbose linking to show which libraries are being used. I think you'll see machine type 8664 on the library, but not on your .OBJ file.
By the way, though, what is "dbpre" in this context? I wonder why you're going down this particular route. I have successfully tested the ocsql preprocessor against several DBMS systems. I tested under Linux, but it's a natural fit on Windows because it uses ODBC. I didn't test MySQL, but I did test MariaDB.
If you encounter difficulties getting ocsql working on Windows, I'll do what I can to help out. I see no reason it shouldn't work, and lots of reasons it should, even if it doesn't.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I think the main point of using dbpre is "one thing [ODBC] left out between the application code and the database".
Plus some environments may use dbpre already and changing to GnuCOBOL without changing (and retesting) the DB part again looks most reasonable in this case.
ODBC gives a lot of benefits but sometimes they may not apply to the given scenario.
And yes: I'd still like to see MySQL handled via esql-oc (and LMDB, I've heard there is an odbc driver for it).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
So, I guess this dbpre, on SourceForge. ISTR that Oracle has a product by the same name.
I'm still cursious why the OP is using it. I grant there may be good reasons. But I would never recommend a MySQL solution, much less a MySQL-only solution. That's why I asked.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
@jklowden
Yes, thats the dbpre i/we are talking about.
Alan Honeyman and another person want to use it under Windows, thats the reason why i am trying to get it working under Windows.
Edit: I just googled for dbpre and only found my project at sourceforge on the first page. Maybe i should sue Oracle for using my name for a precompiler, might be a nice source of income XD
Last edit: The_Piper 2020-11-04
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm working on that free format (-f) too.
On 22/08/2020 01:37, The_Piper wrote:
Vince
You can do a happy dance, @vcoen, i preprocessed, compiled and ran this program earlier :)
but i have no clue if i support every feature of free format, at least dbpre generates coding, which can be compiled with cobc -free without errors and the binary is running and doing what it should do.
Going finally to work on cobmysqlapi.c tomorrow or so, its just the Windows stuff missing, that shouldnt be a big thing.
On 23/08/2020 01:39, The_Piper wrote:
That look good I will grab it when you have finished.
I did look at dbpre and the JC pre-processor when programming my DAL
(Data Access Layer) units for ACAS and these handle the processing in
place for read, write, open, close etc for file handling.
The plus for yours was standard SQL but the JC one has some features
that as a programmer I found time saving.
The JC tool does NOT use standard EXEC SQL statements but extended type
but does simplify some of the elements that are not in the standard SQL
as near as I can tell.
Will still like to try it even if I have to add some more functions to
cover the differences.
In any event I will need to put in support for reading a $SET SQL XYZ
cobol source line to work out what process is being requested where xyz
= MYSQL | MARIA, DB2, POSTGRES, ORACLE etc.
After all it is 'mostly' just a case of changing the CALL routines --
famous last words :)
Exactly, you named it. Just change the CALL's* :P
Technically spoken, its not a problem to add support for DB2, Postgres, ORACLE, whatever.
But i am not a DB admin who knows how to use all those DB systems, so, if thats a request, i need some help to add support for those DB's to dbpre.
Some code will also with SQL often be specially crafted to the sql dialect. This is the reason that Vincent asked for supporting conditional compilation (a plain
$IF xyz
+$IF xyz = literal
/>> IF xyz DEFINED
+>> IF xyz = literal
should be enough for this). A possible solution may be:To allow this to work dbpre would have to:
#
EXEC SQL
lines it has processed in its outputIdeally it would:
#line
, saving the "current original line" and "current actual line"#line itsownoutputname:line
when it starts to insert (= after theEXEC SQL
)#line inputname:line
when it is finishedThis would allow the final cobc to show accurate COBOL line numers for any diagnostic.
On 24/08/2020 03:50, The_Piper wrote:
No, I will do these on a as time and health permits basis.
Vince
Clean compile for my modified cobmysqlapi.c both under Windows and Linux.
At least some progress and success :)
Testing it soon, today it's too late at night.
Okay, it seems to work, at least under Linux.
My version of cobmysqlapi is here (before i'll upload it to SF):
pipsearch.ddns.net/cobmysqlapi.c
But unter Windows i have a problem to compile the cob file with cobc.
I get this error message:
C:\Users\George\C\dbpre-code-r19\dbpre-code-r19>cpctb004b
C:\Users\George\C\dbpre-code-r19\dbpre-code-r19>dbpre PCTB004B -ts=3 -I./
setting option tabstop=3
copybookpath=>.<
dbpre V 0.4 2020-08-22
======================
0 Errors.
C:\Users\George\C\dbpre-code-r19\dbpre-code-r19>REM cobc -x PCTB004B.cob cobmysqlapi.o -L"C:\Program Files\MySQL\MySQL Server 8.0\lib" -lmysql
C:\Users\George\C\dbpre-code-r19\dbpre-code-r19>cobc -x PCTB004B.cob cobmysqlapi.o -L"C:\Program Files\MySQL\MySQL Server 8.0\lib" -lmysqlclient
C:\GnuCobol-3.1\bin/ld.exe: C:\Program Files\MySQL\MySQL Server 8.0\lib/mysqlclient.lib(libssl-1_1-x64.dll): Recognised but unhandled machine type (0x8664) in Import Library Format archive
cobmysqlapi.o:cobmysqlapi.c:(.text+0x52d): undefined reference to
mysql_errno@4' cobmysqlapi.o:cobmysqlapi.c:(.text+0x559): undefined reference to
mysql_error@4'cobmysqlapi.o:cobmysqlapi.c:(.text+0x587): undefined reference to
mysql_errno@4' cobmysqlapi.o:cobmysqlapi.c:(.text+0x5b4): undefined reference to
mysql_error@4'...
Any clues what that might be?
Last edit: The_Piper 2020-08-26
Found your message and saved the .c file so will look at it over the
next day ot so and will try and use it to build one of my DAL modules.
Vince
.
On 27/08/2020 00:11, The_Piper wrote:
Hi;
Sorry have not got back to you as I am having issues building with
connection-c sources and GnuCobol.
Will have yet another try over the end of year period and see if I can
get any further as I am not going out any where .
There again that has been at a minimum for the last nine months.
Vincent
On 27/08/2020 00:11, The_Piper wrote:
Thanks Vince,
I guess, it will work with your stuff.
I am working right now on a new distribution, all files stored in separate directories like src, examples, doc and such and writing a users guide.pdf/odt.
I am going to post here a link to a zip file with all that stuff i want to release to sourceforge soon, so you, @vcoen and @Alan can test it (and maybe do some proof reading of the users guide).
Okay, here is the promised zip file with my latest changes and documentation.
http://pipsearch.ddns.net/dbpre_0.4.zip
The documentation still needs some updates, but dbpre supports now free format and cobmysqlapi.c is updated.
Last edit: The_Piper 2020-09-06
Got the updates and will test shortly but after Wednesday as have to go to Hospital for a procedure on Wed with prep Tuesday so unlikely to feel up to it.
Thanks Vince, no hurry, and all the best and fingers crossed for your stay at the hospital!
On 07/09/2020 02:54, The_Piper wrote:
As there is three version of dbpre all marked as 0.4 I will reversion
this one as v1.2 along with the API file cobmysqlapi39.c
Like wise the various build scripts will end with '.sh' to indicate
that they are scripts.
On the previous version there is two sets of example programs - have to
remind myself of what the second is doing :)
Vince
Somehow i am stuck with that stuff and Windows...
I have installed GnuCobol+gcc for Windows 10 from Arnolds page.
I have installed MySQL.
I can compile dbpre with gcc.
I can compile cobmysqlapi.c with gcc and get an object file.
I can preprocess scb files with dbpre.
But when i compile the preprocessed COBOL source code with cobc i get this from ld.exe:
Recognized but unhandled machine type (0x8664) in Import Library format archive
I compile it this way:
dbpre PCTB003B -ts=3 -I..\copybooks
cobc -x PCTB003B.cob cobmysqlapi.o -L"C:\Programme\MySQL\MySQL Server 8.0\lib" -lmysqlclient -I..\copybooks
Any ideas what the problem might be?
A missing option for cobc maybe to specify the machine type?
Last edit: The_Piper 2020-11-03
That's nothing about cobc but the linker. It sees a x86_64 import library an you likely have used Arnold's 32bit MinGW build. Either use the MSYS2 64bit based one (or install MSYS2 and within via
pacman -S gnucobol
GnuCOBOL) or use a 32bit version of the MySQL client (server can stay 64bit and you possibly already have the 32bit client somewhere, too).Thanks @sf-mensch,
thats it obviously, scrolling down on Arnolds page helps to find a 64 bit version...
Going to try that later, watching the US elections right now on TV :P
Last edit: The_Piper 2020-11-04
As Simon says, the error message means the linker found a library it needs but can't use. The compiled code is 32-bit, but the library (probably the MySQL client library) is 64-bit.
To confirm, run dumpbin /headers on the library. You can use verbose linking to show which libraries are being used. I think you'll see machine type 8664 on the library, but not on your .OBJ file.
By the way, though, what is "dbpre" in this context? I wonder why you're going down this particular route. I have successfully tested the ocsql preprocessor against several DBMS systems. I tested under Linux, but it's a natural fit on Windows because it uses ODBC. I didn't test MySQL, but I did test MariaDB.
If you encounter difficulties getting ocsql working on Windows, I'll do what I can to help out. I see no reason it shouldn't work, and lots of reasons it should, even if it doesn't.
I think the main point of using dbpre is "one thing [ODBC] left out between the application code and the database".
Plus some environments may use dbpre already and changing to GnuCOBOL without changing (and retesting) the DB part again looks most reasonable in this case.
ODBC gives a lot of benefits but sometimes they may not apply to the given scenario.
And yes: I'd still like to see MySQL handled via esql-oc (and LMDB, I've heard there is an odbc driver for it).
So, I guess this dbpre, on SourceForge. ISTR that Oracle has a product by the same name.
I'm still cursious why the OP is using it. I grant there may be good reasons. But I would never recommend a MySQL solution, much less a MySQL-only solution. That's why I asked.
@jklowden
Yes, thats the dbpre i/we are talking about.
Alan Honeyman and another person want to use it under Windows, thats the reason why i am trying to get it working under Windows.
Edit: I just googled for dbpre and only found my project at sourceforge on the first page. Maybe i should sue Oracle for using my name for a precompiler, might be a nice source of income XD
Last edit: The_Piper 2020-11-04
Looks like you are running on Linux but are using the Windows libraries or vice versa.
Please see stackoverflow
Is the Aug 2020 version still the latest and if not where can I get the latest ?