Skip to main content

I copied MF sample DB2 SQL project: Connect project from Windows to RedHat,  try to recompile it under Linux.

I got this error:

[cobollink] cob64 -g -x -t -oConnect Connect.o /opt/ibm/db2/V11.1/lib64/libdb2.so
[cobollink] Connect.o: In function `CONNECT_MFSQLECM-INIT':
[cobollink] /home/cobol/sql/db2ecm/Connect/Connect.cbl:129: undefined reference to `cobdb264'
[cobollink] collect2: error: ld returned 1 exit status
[cobollink] Link complete with errors

Could someone tell me which library should I link to find cobdb264?

Thanks in advance,

-Jack


#DB2.Connect

I copied MF sample DB2 SQL project: Connect project from Windows to RedHat,  try to recompile it under Linux.

I got this error:

[cobollink] cob64 -g -x -t -oConnect Connect.o /opt/ibm/db2/V11.1/lib64/libdb2.so
[cobollink] Connect.o: In function `CONNECT_MFSQLECM-INIT':
[cobollink] /home/cobol/sql/db2ecm/Connect/Connect.cbl:129: undefined reference to `cobdb264'
[cobollink] collect2: error: ld returned 1 exit status
[cobollink] Link complete with errors

Could someone tell me which library should I link to find cobdb264?

Thanks in advance,

-Jack


#DB2.Connect

I use this on my linux machine

-L/home/db2inst1/sqllib/lib64 -ldb2 -d cobdb264

So try changing

/opt/ibm/db2/V11.1/lib64/libdb2.so

To

-L/opt/ibm/db2/V11.1/lib64 –ldb2 –d cobdb264


I copied MF sample DB2 SQL project: Connect project from Windows to RedHat,  try to recompile it under Linux.

I got this error:

[cobollink] cob64 -g -x -t -oConnect Connect.o /opt/ibm/db2/V11.1/lib64/libdb2.so
[cobollink] Connect.o: In function `CONNECT_MFSQLECM-INIT':
[cobollink] /home/cobol/sql/db2ecm/Connect/Connect.cbl:129: undefined reference to `cobdb264'
[cobollink] collect2: error: ld returned 1 exit status
[cobollink] Link complete with errors

Could someone tell me which library should I link to find cobdb264?

Thanks in advance,

-Jack


#DB2.Connect

Thank you. Tony

   [cobol] Compilation complete with no errors.

[cobollink] Linking (64-bit) Connect...

[cobollink] cob64 -g -x -t -oConnect Connect.o /opt/ibm/db2/V11.1/lib64/libdb2.so -d cobdb264

[cobollink] Link complete with no errors

[cobollink]

Also  I change it to:

-L/opt/ibm/db2/V11.1/lib64 -ldb2 -d cobdb264

   [cobol] Compilation complete with no errors.

[cobollink] Linking (64-bit) Connect...

[cobollink] cob64 -g -x -t -oConnect Connect.o -L/opt/ibm/db2/V11.1/lib64 -ldb2 -d cobdb264

[cobollink] Link complete with no errors

[cobollink]

From online document :

documentation.microfocus.com/.../index.jsp

-d means:

Dynamically Load Symbol (-d symb)

Could you tell me which libxxxx.so really need to be loaded at runtime?

Thank you very much again for further information,

-Jack


I copied MF sample DB2 SQL project: Connect project from Windows to RedHat,  try to recompile it under Linux.

I got this error:

[cobollink] cob64 -g -x -t -oConnect Connect.o /opt/ibm/db2/V11.1/lib64/libdb2.so
[cobollink] Connect.o: In function `CONNECT_MFSQLECM-INIT':
[cobollink] /home/cobol/sql/db2ecm/Connect/Connect.cbl:129: undefined reference to `cobdb264'
[cobollink] collect2: error: ld returned 1 exit status
[cobollink] Link complete with errors

Could someone tell me which library should I link to find cobdb264?

Thanks in advance,

-Jack


#DB2.Connect

Thank you. Tony

   [cobol] Compilation complete with no errors.

[cobollink] Linking (64-bit) Connect...

[cobollink] cob64 -g -x -t -oConnect Connect.o /opt/ibm/db2/V11.1/lib64/libdb2.so -d cobdb264

[cobollink] Link complete with no errors

[cobollink]

Also  I change it to:

-L/opt/ibm/db2/V11.1/lib64 -ldb2 -d cobdb264

   [cobol] Compilation complete with no errors.

[cobollink] Linking (64-bit) Connect...

[cobollink] cob64 -g -x -t -oConnect Connect.o -L/opt/ibm/db2/V11.1/lib64 -ldb2 -d cobdb264

[cobollink] Link complete with no errors

[cobollink]

From online document :

documentation.microfocus.com/.../index.jsp

-d means:

Dynamically Load Symbol (-d symb)

Could you tell me which libxxxx.so really need to be loaded at runtime?

Thank you very much again for further information,

-Jack


I copied MF sample DB2 SQL project: Connect project from Windows to RedHat,  try to recompile it under Linux.

I got this error:

[cobollink] cob64 -g -x -t -oConnect Connect.o /opt/ibm/db2/V11.1/lib64/libdb2.so
[cobollink] Connect.o: In function `CONNECT_MFSQLECM-INIT':
[cobollink] /home/cobol/sql/db2ecm/Connect/Connect.cbl:129: undefined reference to `cobdb264'
[cobollink] collect2: error: ld returned 1 exit status
[cobollink] Link complete with errors

Could someone tell me which library should I link to find cobdb264?

Thanks in advance,

-Jack


#DB2.Connect

Hi

One way to find the file is by setting LD_DEBUG and run a DB2 cobol program.

docs.oracle.com/.../index.html

>>>>>>> I have used a simple test program PMETEST

/home/tonyt/test/2695871db2comp3 >export LD_DEBUG=libs

/home/tonyt/test/2695871db2comp3 >export LD_DEBUG_OUTPUT=lddebug.log

/home/tonyt/test/2695871db2comp3 >./PMETEST

main Started >>>>

init Started >>>>

DB2INSTANCE <db2inst1                                                                                            >

connected to db :

work Started >>>>

sqlcode < 0000000000> BCD1 is < 00000000000000000> BCD2 is < 000000013457275552> BCD3 is < 00000000219907074>

test we can access db hv-date <12/05/1993> h7 < 000000000831>

fini Started >>>>

main press any key to return

/home/tonyt/test/2695871db2comp3 >unset LD_DEBUG

/home/tonyt/test/2695871db2comp3 >ls -ltr | tail -n1

-rw-r--r-- 1 tonyt support 32875 Jul 21 10:51 lddebug.log.9699

/home/tonyt/test/2695871db2comp3 >grep "cobdb2" lddebug.log.9699 | grep calling

     9699:     calling init: /home/products/vcdevhub22/lib/cobdb264.so

     9699:     calling fini: /home/products/vcdevhub22/lib/cobdb264.so [0]

/home/tonyt/test/2695871db2comp3 >

>>>>>>>

So this is the file that is loaded at runtime.

/home/products/vcdevhub22/lib/cobdb264.so

You need the –d to allow the compile to complete, the cobol runtime will load this file.

The file is likely a CSO callable shared library

documentation.microfocus.com/.../BKCYCYFLAGS001F033.html

Tony


I copied MF sample DB2 SQL project: Connect project from Windows to RedHat,  try to recompile it under Linux.

I got this error:

[cobollink] cob64 -g -x -t -oConnect Connect.o /opt/ibm/db2/V11.1/lib64/libdb2.so
[cobollink] Connect.o: In function `CONNECT_MFSQLECM-INIT':
[cobollink] /home/cobol/sql/db2ecm/Connect/Connect.cbl:129: undefined reference to `cobdb264'
[cobollink] collect2: error: ld returned 1 exit status
[cobollink] Link complete with errors

Could someone tell me which library should I link to find cobdb264?

Thanks in advance,

-Jack


#DB2.Connect

Thank you, Tony

I will try those DEBUG instructions from you.  meanwhile I did a directly search on the system drive:

sudo find /opt -name cobdb264.so

I found :

/opt/microfocus/VisualCOBOL/lib/cobdb264.so

Formerly I treated it as libcobdb264.so or libSomeThing.so, just like regular library. I went to the wrong direction and cannot find it.

As you pointed out -- it is a COBOL loadable module. rather than a standard c/c library. now it makes more sense to me.

Thank you again for solving all the puzzles here.

-Jack