Hello my name is Johann Guttner and I would like your help please because I am a beginner with Cobol
I am using Oracle Database and did already compile Cobol source code with SQL and Cobol Code I found on the Internet using GNUCobol Version 2.0
I did so with Pro*Cobol Compiler from Oracle
I saw esqlOC but this is just for MySQL
I want to connect to my Oracle Database with a small Cobol Program but I do not know how
If possible I would like to connect with Connection string with DSN
I use Oracle Linux 6.5 and I tried to install GNUCobol too but it says GMP Header and Library do not match
So I compile with Pro*Cobol first and compile later with Cygwin
I hope you people can help me and I thank you for it
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
Anonymous
-
2014-08-07
I think I made progress
I used Code fragements from the Internet
I compiled again with Pro*Cobol, now I compile with GNUCobol and it there is no error.
but when I run the program it shows me
because I cannot install GNUCobol on Oracle Linux 6.5 I compiled it with Lubuntu now
I copied libsql12.a and libclntsh.so.12.1 to Lubuntu
I used this command here
and I also tried with clntsh instead of sql12
I renamed "CALL SQLADR" to "CALL sqladr" also because libsql12.a has lower characters with sqladr
thank you again
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I've never used Pro*COBOL before. Without further investigation I think libsql12.a may be a static library (just add it to your cobc command line in this case, for example 'cobc -x -I ./copy datenbank.cbl libsql12.a') while libclntsh.so (Where did you copied the .so.12.1 file from?) is a dynamically loading library (which should be renamed to .so and put into environment via export COB_PRE_LOAD=libclntsh (.so will be added by libcob))?
If you're sure sqladr is exported only with lower characters the change to lowercase is correct.
What does the manual for Pro*COBOL says?
Simon
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
Anonymous
-
2014-08-08
I tried with 'cobc -x -I ./copy datenbank.cbl libsql12.a'
It did not work
I renamed to libclntsh.so too
I copied the .so.12.1 file from $ORACLE_HOME$/lib
This files come from Oracle Database Version 12c
Oracle says:
For clarity and ease of development, the library structure is changed starting with Oracle Database 12c Release 1 (12.1). The client shared library, libclntsh.so.12.1, depends on libclntshcore.so.12.1. The libclntshcore.so.12.1 library contains the NLS and CORE functionality. Both of these libraries must be installed in the same directory.
And yes I copied libclntshcore too
Oracle Documentation about Pro*Cobol is not very good
Maybe it is better if I am able to install GNUCobol on Oracle Linux Server 6.5 because everything else is installed there already
You do not know how to solve this GMP Error or? [oracle@localhost gnu-cobol-2.0]$ ./configure -enable-debug
.
.
.
.
checking gmp.h usability... yes
checking gmp.h presence... yes
checking for gmp.h... yes
checking for __gmpz_init in -lgmp... yes
checking matching GMP version ... no
Header has version 6.0.0
Library has version 4.3.1
configure: error: Unable to use GMP - Please check config.log
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
Anonymous
-
2014-08-11
does noone at least know how to fix the GMP Error?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sounds weird. How did you installed gmp?
Please post config.log and we will see more details.
BTW: You do know that your configure line leads to debugging symbols in GNU Cobol, don't you?
Simon
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
Anonymous
-
2014-08-13
Thank you Brian I was able to install GNUCobol now and I was able to compile everything without SQLADR Error
But I get a Error when I run the program now
Pro*Cobol makes a "CALL SQLBEX" into my program and it crashes when it wants to be called
the Error says
Attempt to reference unallocated memory (Signal SIGSEGV)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Can you post the program and markt the part with the error ? May be there is something missing, what the precompiler is not printing out sqlca or other things. I wrote many sql-oracle-Programs on an IBM Z/OS-Host with Cobol85 and they work fine.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
@Johann: I'm 99.9% sure to know the cause of your problem.
you should register to be able to post without moderation and I'd also send you a private message with my skype id if you need further help.
best wishes,
Brian
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks Brian for support,
where I found instruction for right configuration?
I tried to put in the file pcbcfg.cfg "Comp5 = yes" and "Comp5 = no" without solving the problem.
Andrea
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
could you clarify what your exact problem is?
if possible provide some code for better explanation please.
best wishes,
Brian
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
Anonymous
-
2014-09-15
This is the code Brian:
::cobolIDENTIFICATIONDIVISION.PROGRAM-ID.RDS-TEST.***********************************************Testconnessioneadb***********************************************ENVIRONMENTDIVISION.CONFIGURATIONSECTION.INPUT-OUTPUTSECTION.DATADIVISION.*WORKING-STORAGESECTION.*EXECSQLBEGINDECLARESECTIONEND-EXEC.*01WK-USERPICX(10)VARYING.01WK-PWDPICX(10)VARYING.01OWK-DBPICX(10)VARYING.*EXECSQLENDDECLARESECTIONEND-EXEC.*EXECSQLINCLUDESQLCA.COBEND-EXEC.*PROCEDUREDIVISION.*CONNESSIONE-ORACLE.DISPLAY"COLLEGAMENTO AL DB IN CORSO...".MOVE"********"TOWK-USER.MOVE"********"TOWK-PWD.MOVE"***"TOOWK-DB.EXECSQLWHENEVERSQLWARNINGCONTINUEEND-EXEC.EXECSQLWHENEVERSQLERRORGOTOCHIUDIEND-EXEC.EXECSQLWHENEVERNOTFOUNDGOTOCHIUDIEND-EXEC.*CONNECT-ORACLE.EXECSQLCONNECT:WK-USERIDENTIFIEDBY:WK-PWDAT:OWK-DBUSING:OWK-DBEND-EXEC.DISPLAY"COLLEGAMENTO AL DB RIUSCITO!".*CHIUDI.DISPLAYSQLERRMC.STOPRUN.
::textCOB=cobc# InstantClient Directories.ICSDKHOME=$(ORACLE_HOME)/sdkICLIBHOME=$(ORACLE_HOME)/MKLINK=lnREMOVE=rm-rfCLNCACHE=cleancacheCACHEDIR=SunWS_cacheaMAKE=makeMAKEFILE=procob.mkPROCOBDEMO=$(ORACLE_HOME)/*PROCOB=$(ICSDKHOME)/procobICLIBPATH=$(LDPATHFLAG)$(ICLIBHOME)SO_EXT=.so# MICROFOCUS# COBFLAGS=-C IBMCOMP -C NESTCALL -t -x# OPENCOBOLCOBFLAGS=-x#PROCOBFLAGS=picx=varchar2LDPATHFLAG=-LCOBSQLINTF=$(ICLIBHOME)cobsqlintf.oLDLIBS=$(EXSYSLIBS)$(MATHLIB)$(USRLIBS)EXSYSLIBS=-ldlMATHLIB=-lmCOBOL_PROLDLIBS=$(SHARED_CLIENTLIBS)$(LDLIBS)SHARED_CLIENTLIBS=$(LLIBCLNTSH)$(LDFLAGS)LLIBCLNTSH=$(LDLIBFLAG)$(LIBCLNTSHNAME)LDLIBFLAG=-lLIBCLNTCORENAME=clntshcoreLIBCLNTSHNAME=clntshLDFLAGS=-gDEMO_PROCOB_BUILD=$(COB)$(COBFLAGS)-o$(EXE)$(COBS)$(ICLIBPATH)$(COBSQLINTF)$(COBOL_PROLDLIBS)#DEMO_PROCOB_BUILD=$(COB) -x -o $(EXE) $(COBS) $(ICLIBPATH) $(COBSQLINTF) $(COBOL_PROLDLIBS)##### MICROFOCUS#DEMO_PROCOB_BUILD_SHARED=$(COB) $(COBFLAGS) -o $(EXE) $(COBS) $(LDPATHFLAG)$(LIBHOME) $(COBSQLINTF) $(COBOL_PROLDLIBS)##### OPENCOBOL#DEMO_PROCOB_BUILD_SHARED=$(COB) $(COBFLAGS) $(COBS) $(LDPATHFLAG)$(LIBHOME) $(COBSQLINTF) $(COBOL_PROLDLIBS)##### MICROFOCUS#DEMO_PROCOB_BUILD_STATIC=$(COB) $(COBFLAGS) -o $(EXE) $(COBS) $(LDPATHFLAG)$(LIBHOME) $(COBSQLINTF) $(COBOL_STATICPROLDLIBS)##### OPENCOBOL#DEMO_PROCOB_BUILD_STATIC=$(COB) $(COBFLAGS) $(COBS) $(LDPATHFLAG)$(LIBHOME) $(COBSQLINTF) $(COBOL_STATICPROLDLIBS)#-----------------------------------------------------------------------------# Targets for building the procob sample programs.## The target 'build' puts together an executable $(EXE) from the cobol# sources in $(COBS) and the libraries in $(COBOL_PROLDLIBS).# The rules to make .cob files from .pco files are later in this file.#all:clean$(PROCOBDEMO)$(PROCOBDEMO):$(MAKE)-f$(MAKEFILE)buildCOBS=$@.cobEXE=$@build:$(CLNCACHE)$(COBS)$(MKLINK)$(ICLIBHOME)libclntshcore$(SO_EXT).12.1$(ICLIBHOME)libclntshcore$(SO_EXT)$(MKLINK)$(ICLIBHOME)libclntsh$(SO_EXT).12.1$(ICLIBHOME)libclntsh$(SO_EXT)$(DEMO_PROCOB_BUILD)$(REMOVE)$(ICLIBHOME)libclntshcore$(SO_EXT)$(REMOVE)$(ICLIBHOME)libclntsh$(SO_EXT)#.SUFFIXES:.cob.cbl.o.pco$(GNT).pco.cob:$(PROCOB)$(PROCOBFLAGS)iname=$*.pco.cob$(GNT):$(COB2GNT)clean:$(CLNCACHE)$(REMOVE)$(PROCOBDEMO)$(PROCOBDEMO).o$(PROCOBDEMO).cob$(PROCOBDEMO).lis$(PROCOBDEMO).int$(PROCOBDEMO).idycleancache:$(REMOVE)$(CACHEDIR)$(REMOVE)$(ICLIBHOME)libclntshcore$(SO_EXT)$(REMOVE)$(ICLIBHOME)libclntsh$(SO_EXT)
::text
./rds-test
COLLEGAMENTO AL DB IN CORSO...
/WRK/COBOL/SORGENTI/rds-test.cob: 243: Attempt to reference unallocated memory (Signal SIGSEGV)
Abnormal termination - File contents may be incorrect
At line 243 in rds-test.cob there is this instruction:
::text236CALL"SQLADR"USING237SQL-SQHARM(1)238SQL-SQPARM239CALL"SQLADR"USING240SQL-SQHARC(1)241SQL-SQPARC242243CALL"SQLBEX"USING244SQLCTX245SQLEXD246SQLFPN247248IFSQLCODEINSQLCAISLESSTHAN0249THENGOTOCHIUDIEND-IF.250DISPLAY"COLLEGAMENTO AL DB RIUSCITO!".251
The error is generated if I declare the variable "PIC X" as "varying". If I do not put "varying" this runtime error does not appear but unfortunately not applied the parameter "Picx = varchar2" but "Picx = Charf" although in the configuration file (pcbcfg.cfg) there is.
Not removing the spaces in the bottom of the strings and the connection fails, however, the activity with sql strings become complicated ...
You need some more information?
I hope that I have not posted too much stuff ...
Thanks a lot.
Andrea
Last edit: Brian Tiffin 2014-10-14
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
My code is the same of "Anonymous" posted 2014-08-14, the only difference is on variable declaration (I put VARYING).
The runtime error (Attempt to reference unallocated memory (Signal SIGSEGV)
Abnormal termination - File contents may be incorrect) is generated if I declare the variable "PIC X" as "varying". If I do not put "varying" this runtime error does not appear but unfortunately not applied the parameter "Picx = varchar2" but "Picx = Charf" although in the configuration file (pcbcfg.cfg) there is.
Not removing the spaces in the bottom of the strings and the connection fails, however, the activity with sql strings become complicated ...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Brian,
problems persist in every way ...
If I use the statement "VARYING" I have a runtime error "Attempt to reference unallocated memory (Signal SIGSEGV)", also adding correctly the "MOVE" you suggested
But if I do not use "VARYING" I can not operate the variables "PIC X" as "varchar" instead of "Charf." In pcbcfg file (Oracle precompiler) I put "Picx = varchar2" without results ...
Thanks for your patience
Andrea
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I've found this note on Oracle support... maybe...
My Oracle Client e Precompiler are 64bit (12.1 release).
I've installed Opencobol 2.0 but where can i found if it is 64 or 32?
ok is 64 bit
ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=5ea1697b84416c488fc55d0b2977f21494533ff0, not stripped
Oracle client and precompiler sdk is 64 bit too.
This is not the right way ...
I keep looking for the solution to the problem ...
Thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello my name is Johann Guttner and I would like your help please because I am a beginner with Cobol
I am using Oracle Database and did already compile Cobol source code with SQL and Cobol Code I found on the Internet using GNUCobol Version 2.0
I did so with Pro*Cobol Compiler from Oracle
I saw esqlOC but this is just for MySQL
I want to connect to my Oracle Database with a small Cobol Program but I do not know how
If possible I would like to connect with Connection string with DSN
I use Oracle Linux 6.5 and I tried to install GNUCobol too but it says GMP Header and Library do not match
So I compile with Pro*Cobol first and compile later with Cygwin
I hope you people can help me and I thank you for it
I think I made progress
I used Code fragements from the Internet
I compiled again with Pro*Cobol, now I compile with GNUCobol and it there is no error.
but when I run the program it shows me
datenbank.cbl: 132: libcob: Cannot find module 'sqladr'
because I cannot install GNUCobol on Oracle Linux 6.5 I compiled it with Lubuntu now
I copied libsql12.a and libclntsh.so.12.1 to Lubuntu
I used this command here
export COB_LIBRARY_PATH="~/Desktop/lib/"
COB_PRE_LOAD=libsql12.a
cobc -x -I ./copy/ -L ./lib/ -sql12.a
export COB_LIBRARY_PATH="~/Desktop/lib/"
COB_PRE_LOAD=libsql12.a
./datenbank
and I also tried with clntsh instead of sql12
I renamed "CALL SQLADR" to "CALL sqladr" also because libsql12.a has lower characters with sqladr
thank you again
I've never used Pro*COBOL before. Without further investigation I think libsql12.a may be a static library (just add it to your cobc command line in this case, for example 'cobc -x -I ./copy datenbank.cbl libsql12.a') while libclntsh.so (Where did you copied the .so.12.1 file from?) is a dynamically loading library (which should be renamed to .so and put into environment via export COB_PRE_LOAD=libclntsh (.so will be added by libcob))?
If you're sure sqladr is exported only with lower characters the change to lowercase is correct.
What does the manual for Pro*COBOL says?
Simon
I tried with 'cobc -x -I ./copy datenbank.cbl libsql12.a'
It did not work
I renamed to libclntsh.so too
I copied the .so.12.1 file from $ORACLE_HOME$/lib
This files come from Oracle Database Version 12c
Oracle says:
For clarity and ease of development, the library structure is changed starting with Oracle Database 12c Release 1 (12.1). The client shared library, libclntsh.so.12.1, depends on libclntshcore.so.12.1. The libclntshcore.so.12.1 library contains the NLS and CORE functionality. Both of these libraries must be installed in the same directory.
And yes I copied libclntshcore too
Oracle Documentation about Pro*Cobol is not very good
Maybe it is better if I am able to install GNUCobol on Oracle Linux Server 6.5 because everything else is installed there already
You do not know how to solve this GMP Error or?
[oracle@localhost gnu-cobol-2.0]$ ./configure -enable-debug
.
.
.
.
checking gmp.h usability... yes
checking gmp.h presence... yes
checking for gmp.h... yes
checking for __gmpz_init in -lgmp... yes
checking matching GMP version ... no
Header has version 6.0.0
Library has version 4.3.1
configure: error: Unable to use GMP - Please check config.log
does noone at least know how to fix the GMP Error?
as far as I'm aware you probably installed gmp with yum.
ol6.repo is pretty old not to say ancient which leads to your library version 4.3.1 .
did you try to install gmp from source?
I installed gmp6-0-0 now and now I get this Error when I do ./configure --enable-debug
configure: error: Unable to extract GMP version information from gmp.h
I tried to run configure with Administrator too
this has nothing to do with gmp.h .
it's IMHO a missing symbolic link.
I'm pretty sure you're using a 64bit oracle linux.
do something like this:
best wishes,
Brian
Sounds weird. How did you installed gmp?
Please post config.log and we will see more details.
BTW: You do know that your configure line leads to debugging symbols in GNU Cobol, don't you?
Simon
Thank you Brian I was able to install GNUCobol now and I was able to compile everything without SQLADR Error
But I get a Error when I run the program now
Pro*Cobol makes a "CALL SQLBEX" into my program and it crashes when it wants to be called
the Error says
Attempt to reference unallocated memory (Signal SIGSEGV)
Can you post the program and markt the part with the error ? May be there is something missing, what the precompiler is not printing out sqlca or other things. I wrote many sql-oracle-Programs on an IBM Z/OS-Host with Cobol85 and they work fine.
are all libs same architecture all 64Bit or all 32Bit ?
I do not know if all are 64bit how shall I check that?
I tried this program
It crashes with the Database Login
run:
Last edit: Simon Sobisch 2014-09-11
@Johann: I'm 99.9% sure to know the cause of your problem.
you should register to be able to post without moderation and I'd also send you a private message with my skype id if you need further help.
best wishes,
Brian
Hi Brian I have the same problem. Have you find a solution?
Andrea
hi Andrea,
does your problem still persist?
if so pls check for correct COMP/COMP-5 config settings first
best wishes,
Brian
Thanks Brian for support,
where I found instruction for right configuration?
I tried to put in the file pcbcfg.cfg "Comp5 = yes" and "Comp5 = no" without solving the problem.
Andrea
okay Andrea,
could you clarify what your exact problem is?
if possible provide some code for better explanation please.
best wishes,
Brian
This is the code Brian:
This is my pcbcfg.cfg parameter
This is my procob.mk
When I compile this is output:
When I run the program... this is the error:
At line 243 in rds-test.cob there is this instruction:
The error is generated if I declare the variable "PIC X" as "varying". If I do not put "varying" this runtime error does not appear but unfortunately not applied the parameter "Picx = varchar2" but "Picx = Charf" although in the configuration file (pcbcfg.cfg) there is.
Not removing the spaces in the bottom of the strings and the connection fails, however, the activity with sql strings become complicated ...
You need some more information?
I hope that I have not posted too much stuff ...
Thanks a lot.
Andrea
Last edit: Brian Tiffin 2014-10-14
My code is the same of "Anonymous" posted 2014-08-14, the only difference is on variable declaration (I put VARYING).
The runtime error (Attempt to reference unallocated memory (Signal SIGSEGV)
Abnormal termination - File contents may be incorrect) is generated if I declare the variable "PIC X" as "varying". If I do not put "varying" this runtime error does not appear but unfortunately not applied the parameter "Picx = varchar2" but "Picx = Charf" although in the configuration file (pcbcfg.cfg) there is.
Not removing the spaces in the bottom of the strings and the connection fails, however, the activity with sql strings become complicated ...
Oracle DB needs to know the password and username length.
in your code you only supply pw & username.
you also need something like:
MOVE 10 TO PASSWORD-LEN.
MOVE 10 TO USERNAME-LEN.
Hi Brian,
problems persist in every way ...
If I use the statement "VARYING" I have a runtime error "Attempt to reference unallocated memory (Signal SIGSEGV)", also adding correctly the "MOVE" you suggested
But if I do not use "VARYING" I can not operate the variables "PIC X" as "varchar" instead of "Charf." In pcbcfg file (Oracle precompiler) I put "Picx = varchar2" without results ...
Thanks for your patience
Andrea
I've found this note on Oracle support... maybe...
My Oracle Client e Precompiler are 64bit (12.1 release).
I've installed Opencobol 2.0 but where can i found if it is 64 or 32?
you can use the 'file' command if you've produced an executable (cobc -x)
e.g.:
'file ~/Desktop/gnuc'
or
'file gnuc' if you already are in the working directory
Last edit: Brian 2014-09-16
ok is 64 bit
ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=5ea1697b84416c488fc55d0b2977f21494533ff0, not stripped
Oracle client and precompiler sdk is 64 bit too.
This is not the right way ...
I keep looking for the solution to the problem ...
Thanks