|
From: | Patrick |
Subject: | Re: [open-cobol-list] Open COBOL Build 426 Not Finding Modules |
Date: | Mon, 15 Sep 2014 10:39:49 -0400 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.7.0 |
Hi Marty
I am not much help to you , turns out I need help. I copied Brian's example from the site, (I don't know why but your email took out the newlines) I downloaded and installed 426. Why does this show it's version 1.1 ? Aren't we into the 2.* series ? cobc -V cobc (GNU Cobol) 1.1.0 Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Keisuke Nishida Copyright (C) 2006-2012 Roger While This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Built Sep 15 2014 10:24:16 Packaged Jan 20 2014 07:40:53 UTC C version "4.7.2" I had this error: cobc -x -lpq pgcob.cob pgcob.cob:58: Error: syntax error, unexpected NULL, expecting Identifier I haven't used null personally so I just created an variable null and tried this: cobc -x -lpq pgcob.cob pgcob.cob:18: Error: syntax error, unexpected NULL, expecting EXTERNAL or GLOBAL So it does have knowledge of null but doesn't expect it in this position. I am not much help yet but maybe you should post your version of gcc. You could also compile it cobc -C and then use gcc in verbose mode so that others would have more info. I have to work right now but I will try to figure out where I am stuck and maybe I will be able to help after, but probably not :( Thanks On 15/09/14 09:10 AM, Marty Heyman wrote: Patrick,The code is copied below. It is Brian’s example from the FAQ section 5.4.6. I get similar results without -x and running cobcrun (which then can’t find PGTest.so).I haven’t statically linked stuff yet … will try in a bit. Have a customer on the phone at the moment.—— START CODE ——OCOBOL*> *************************************************************** *> Author: Brian Tiffin *> Date: 20091129 *> Purpose: PostgreSQL connection test *> Tectonics: cobc -x -lpq pgcob.cob *> *************************************************************** identification division. program-id. pgcob. data division. working-storage section. 01 pgconn usage pointer. 01 pgres usage pointer. 01 resptr usage pointer. 01 resstr pic x(80) based. 01 result usage binary-long. 01 answer pic x(80). *> *************************************************************** procedure division. display "Before connect:" pgconn end-display call "PQconnectdb" using by reference "dbname = postgres" & x"00" returning pgconn end-call display "After connect: " pgconn end-display call "PQstatus" using by value pgconn returning result end-call display "Status: " result end-display call "PQuser" using by value pgconn returning resptr end-call set address of resstr to resptr string resstr delimited by x"00" into answer end-string display "User: " function trim(answer) end-display display "call PQexec" end-display call "PQexec" using by value pgconn by reference "select version();" & x"00" returning pgres end-call display pgres end-display *> Pull out a result. row 0, field 0 <* call "PQgetvalue" using by value pgres by value 0 by value 0 returning resptr end-call set address of resstr to resptr string resstr delimited by x"00" into answer end-string display "Version: " answer end-display call "PQfinish" using by value pgconn returning null end-call display "After finish: " pgconn end-display call "PQstatus" using by value pgconn returning result end-call display "Status: " result end-display *> this will now return garbage <* call "PQuser" using by value pgconn returning resptr end-call set address of resstr to resptr string resstr delimited by x"00" into answer end-string display "User after: " function trim(answer) end-display goback. end program pgcob.— END CODE — start cobc -v output ———address@hidden:~/Projects/PlanBTest/mhWork$ cobc -L/usr/lib -lpq -std=mvs -v ../cobol_source/PGTest.cbl Command line: cobc -L/usr/lib -lpq -std=mvs -v ../cobol_source/PGTest.cbl Preprocessing: ../cobol_source/PGTest.cbl -> /tmp/cob41797_0.cob Return status: 0 Parsing: /tmp/cob41797_0.cob (../cobol_source/PGTest.cbl) Return status: 0 Translating: /tmp/cob41797_0.cob -> /tmp/cob41797_0.c (../cobol_source/PGTest.cbl) Executing: gcc -std=gnu99 -I/usr/local/include -pipe -Wno-unused -fsigned-char -Wno-pointer-sign -shared -fPIC -DPIC -Wl,--export-dynamic -o "PGTest.so" "/tmp/cob41797_0.c" -L/usr/local/lib -lcob -lm -lgmp -lncurses -ldb -ldl -l"pq" -L"/usr/lib" Return status: 0 address@hidden:~/Projects/PlanBTest/mhWork$——— END cobc -v output ———> Patrick wrote> Hi Marty > Do you have a little snippet of test code you could share ? > I am on Debian Stable. I don't seem to be having trouble but maybe I am > missing something and have the bug too. > Is it possible to statically link to see if the problem goes away? > Could you compile in verbose mode and share? Thanks |
[Prev in Thread] | Current Thread | [Next in Thread] |