gnucobol-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[open-cobol-list] Success with open-cobol and Oracle PRO*Cobol 9.2.0.4


From: Gary
Subject: [open-cobol-list] Success with open-cobol and Oracle PRO*Cobol 9.2.0.4
Date: Mon Dec 22 08:05:00 2003
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030821

I don't know if anyone has done this before but I've succesfully compiled and linked a CoBOL application compiled with open-cobol and Oracle PRO*Cobol precompiler.

I found a few wrinkles along the way:

Firstly, here is the small PRO*Cobol program:

        identification division.
        program-id. tc.
        data division.
        working-storage section.

                exec sql begin declare section end-exec.

        01 hvs.
                05 hv-userid pic x(8).
                05 hv-passwd pic x(8).
                05 hv-ename pic x(8).
                05 hv-empno pic x(8).

                exec sql end declare section end-exec.

                exec sql include sqlca end-exec.

        procedure division.
        a-main section.
                move 'scott' to hv-userid.
                move 'tiger' to hv-passwd.
                exec sql connect :hv-userid identified by :hv-passwd
                end-exec.
                display 'sqlcode connect ' sqlcode.
                exec sql declare c1 cursor for
                        select ename,empno from emp
                end-exec
                exec sql open c1
                end-exec
                exec sql fetch c1 into
                        :hv-ename,:hv-empno
                end-exec
                perform until sqlcode not = 0
                        display 'ename ' hv-ename ' empno ' hv-empno
                        exec sql fetch c1 into
                                :hv-ename,:hv-empno
                        end-exec
                end-perform.
                stop run.

Firsly, issued

$ procob tc.pco

giving me a tc.cob

Now I have to change the output from PRO*Cobol, to change all calls to 'SQLADR' to 'sqladr' and all calls to 'SQLBEX' to 'sqlbex' this is because the client library we will be linking with later has these functions in lower case, and we don't find them with upper (you don't have to do this with MF Cobol so I'm presuming they try both versions).

Once that's done, we can:

$ cobc -c -fmain tc.cob

and

$ gcc -o tc tc.o -L/usr/local/lib -lcob -L$ORACLE_HOME/lib -lclntsh

The resulting output works fine.

I couldn't find a way of issuing a single cobc call which would compile my CoBOL program and link it with the Oracle library.

This is very encouraging!

(note: thanks for putting the ./configure stuff into the CVS tree, I can now run the latest version).

The main things stopping me from compiling my full application now, is lack of USAGE POINTER support and nested sub programs.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]