HOME  NEWS  FORUM  DOWNLOAD  LINK
OpenCOBOL - an open-source COBOL compiler
Main Menu
Download
Documentation
Development
Who's Online
18 user(s) are online (5 user(s) are browsing Forum)

Members: 0
Guests: 18

more...
Powered by
SourceForge

Xoops

Creative Commons

OpenCOBOL Forum Index
   OpenCOBOL
     DB2 Express-C using Windows 7
Register To Post

Threaded | Newest First Previous Topic | Next Topic | Bottom
Poster Thread
btiffin
Posted on: 2012/2/4 17:37
Home away from home
Joined: 2008/6/7
From: CANADA
Posts: 1196
DB2 Express-C using Windows 7
from iainw on forum.peoplecards.ca, with one edit to put in code blocks


Hello,

I'm having problem with a program compiling an OpenCOBOL 1.1 program which uses DB2 Express-C in a Windows 7 environment. Following the advice on the forum I have updated libcob.h, adding:
#ifdef DB2SQL
#include <sqlaprep.h>
#endif

Have the following system variables:
COB_LIBRARY_PATH = C:\OC\pgms
COBCPY = C:\OC\pgms
INCLUDE = C:\PROGRA~2\IBM\SQLLIB\INCLUDE;C:\PROGRA~2\IBM\SQLLIB\LIB
LIB = ;C:\PROGRA~2\IBM\SQLLIB\LIB
LINK = C:\Cobol\lib\db2api.lib
PATH is set up to included all required OC and DB2 programs etc.

Using the DB2 Express-C line command processor (DOS window), connected to the sample database and precomiled the program:
(1) connect to sample
(2) prep C:\OC\pgms\db2test2.sqb bindfile using C:\OC\pgms\db2test2.bnd target ANSI_COBOL

In Cgywin tried to compile the program, commans used = cobc -v -x -I C:\PROGRA~2\IBM\SQLLIB\lib -fixed -fstatic -D DB2SQL db2test2.cbl
Get the following:
preprocessing db2test2.cbl into /tmp/cob3872_0.cob
translating /tmp/cob3872_0.cob into /tmp/cob3872_0.c
gcc-4 -pipe -c -I/usr/local/include   -Wno-unused -fsigned-char -Wno-pointer-sig
n -IC:PROGRA~2IBMSQLLIBlib -DDB2SQL  -o /tmp/cob3872_0.o /tmp/cob3872_0.c
gcc-4 -pipe  -Wl,--export-all-symbols -Wl,--enable-auto-import -o db2test2 /tmp/
cob3872_0.o  -L/usr/local/lib -lcob -lm -lgmp -lintl -lncurses -ldb
/tmp/cob3872_0.o:cob3872_0.c:(.text+0xaaf): undefined reference to `_sqlgstrt'
/tmp/cob3872_0.o:cob3872_0.c:(.text+0xb84): undefined reference to `_sqlgaloc'
/tmp/cob3872_0.o:cob3872_0.c:(.text+0xcbf): undefined reference to `_sqlgstlv'
/tmp/cob3872_0.o:cob3872_0.c:(.text+0xdbb): undefined reference to `_sqlgcall'
/tmp/cob3872_0.o:cob3872_0.c:(.text+0xe1b): undefined reference to `_sqlgstop'
/tmp/cob3872_0.o:cob3872_0.c:(.text+0x11fe): undefined reference to `_sqlgstrt'
/tmp/cob3872_0.o:cob3872_0.c:(.text+0x12fa): undefined reference to `_sqlgcall'
/tmp/cob3872_0.o:cob3872_0.c:(.text+0x135a): undefined reference to `_sqlgstop'
/tmp/cob3872_0.o:cob3872_0.c:(.text+0x147f): undefined reference to `_sqlgstrt'
/tmp/cob3872_0.o:cob3872_0.c:(.text+0x1554): undefined reference to `_sqlgaloc'
/tmp/cob3872_0.o:cob3872_0.c:(.text+0x169b): undefined reference to `_sqlgstlv'
/tmp/cob3872_0.o:cob3872_0.c:(.text+0x17e2): undefined reference to `_sqlgstlv'
/tmp/cob3872_0.o:cob3872_0.c:(.text+0x1929): undefined reference to `_sqlgstlv'
/tmp/cob3872_0.o:cob3872_0.c:(.text+0x1a70): undefined reference to `_sqlgstlv'
/tmp/cob3872_0.o:cob3872_0.c:(.text+0x1bb7): undefined reference to `_sqlgstlv'
/tmp/cob3872_0.o:cob3872_0.c:(.text+0x1cfe): more undefined references to `_sqlg
stlv' follow
/tmp/cob3872_0.o:cob3872_0.c:(.text+0x1f41): undefined reference to `_sqlgcall'
/tmp/cob3872_0.o:cob3872_0.c:(.text+0x1fa1): undefined reference to `_sqlgstop'
/tmp/cob3872_0.o:cob3872_0.c:(.text+0x22fb): undefined reference to `_sqlgstrt'
/tmp/cob3872_0.o:cob3872_0.c:(.text+0x23f7): undefined reference to `_sqlgcall'
/tmp/cob3872_0.o:cob3872_0.c:(.text+0x2457): undefined reference to `_sqlgstop'
/tmp/cob3872_0.o:cob3872_0.c:(.text+0x25cf): undefined reference to `_sqlgstrt'
/tmp/cob3872_0.o:cob3872_0.c:(.text+0x26cb): undefined reference to `_sqlgcall'
/tmp/cob3872_0.o:cob3872_0.c:(.text+0x272b): undefined reference to `_sqlgstop'
collect2: ld returned 1 exit status

Can anyone suggest what I need to do to get a clean compile please?

Regards,
iain
human
Posted on: 2012/2/5 21:04
Home away from home
Joined: 2007/5/15
From: GERMANY
Posts: 1416
Re: DB2 Express-C using Windows 7
Hi and Welcome at opencobol.org (via peoplecards).

I think the problem roots in different compiling tools. Either use the DB-Express Win binaries (with Microsoft Visual C [Express]) or compile the libraries from unix sources within Cygwin.

human
btiffin
Posted on: 2012/2/29 6:52
Home away from home
Joined: 2008/6/7
From: CANADA
Posts: 1196
Re: DB2 Express-C using Windows 7
Hello Human,

Thanks for the welcome. I have Visual Studio 2010 Express installed but not using it. I'm not a C/C++ person so can you give me a pointer on how to compile the Cygwin libraries please?

My biggest problem is that I'm a mainframe dinosaur, hence the desire to use COBOL! Due to work it will probably be next weekend before I get to sort out this.

iain
cross posted by btiffin for iainw from forum.peoplecards.ca
Franklin
Posted on: 2012/2/29 9:03
Not too shy to talk
Joined: 2006/6/22
From: Hamburg, Germany
Posts: 35
Re: DB2 Express-C using Windows 7
Hi,

i havn't tried using Cygwin and DB2 but it looks like 2 problems to me.

1. The -I C:\PROGRA~2\IBM\SQLLIB\lib seems to be interpreted without the backslashes. Try using normal slashes "C:/PROGRA~2/IBM/SQLLIB/lib" or user double backslashes "C:\\PROGRA~2\\IBM\\SQLLIB\\lib"

2. You will need to include the db2api.lib in some way, try using "-l db2api".

I hope this will help you.

Regards,
Franklin
human
Posted on: 2012/2/29 11:16
Home away from home
Joined: 2007/5/15
From: GERMANY
Posts: 1416
Re: DB2 Express-C using Windows 7
Franklin is right for both problems, but I guess the solution for 2. won't work as the lib won't be found/used as it is an MSC library (try this at least, maybe I'm wrong).
If it doesn't work you have three choices:
1. run cygwin setup and try to find DB2 express packages there, if available, install them
2. get sources for compiling the library within Cygwin via ./configure + make + make install (this is the manual way of 1., but I'm not positive this will be possible as I did not found a source tarball at DB2 Express download page)
3. Don't use Cygwin for OpenCOBOL but a MSC-package (if you don't knwo how to compile OC with MSC on your own, use a package of http://www.kiska.net/opencobol/1.1/ (I highly suggest NOT to use the binaries from newer snapshots but these from 2009).

human
btiffin
Posted on: 2012/3/2 10:11
Home away from home
Joined: 2008/6/7
From: CANADA
Posts: 1196
Re: DB2 Express-C using Windows 7
off topic
The one-click easy install forum.peoplecards.ca seems to be suffering the same symptoms that plagued opencobol.org for a while (and why new registrations are still blocked).

I'm on an entry level shared server on Dreamhost. Something on the shared server (my guess being, accumulated spam) is tripping the SQL engine watchdog / eating all performance.

So, the last two entries are not cross posted. I'm going to look into it / pester Dreamhost / redo on a server I know has cyles. forum.peoplecards.ca has less than 1000 db entries so, I'm guessing, it's another site on the box causing the grief.

Or, it's time to officially move the forum part of opencobol.org while the new site is developed. It's in the works, but finding and synchronizing time with the principals is proving difficult. Might just assume go, and go.

Brian
Threaded | Newest First Previous Topic | Next Topic | Top

Register To Post
 
Copyright (C) 2005 The OpenCOBOL Project. All rights reserved.
Powered by Xoops2 | PHP | MySQL | Apache
ocean-net