Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Cannot run COBOL stored procedure on DB2 - SQL error 444

147 views
Skip to first unread message

melmack

unread,
Jun 30, 2009, 10:04:46 AM6/30/09
to
Hello

I'm trying to run simple stored procedure written in COBOL on DB2.
However I have no idea how to force it to work... :)

Procedure code is as follows (file HELLO.cob):

IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO.
ENVIRONMENT DIVISION.
DATA DIVISION.
PROCEDURE DIVISION.
DISPLAY "Hello, World!".
STOP RUN.

File has been compiled to executable, static library and shared
library with TinyCOBOL compiler -> results are accordingly HELLO,
HELLO.a, HELLO.so.
All of these files have been put to directory /home/db2inst1/sqllib/
function and their privileges have been changed to 777.

I tried to create stored procedure using these files in several ways
like this:

CREATE PROCEDURE PROCEDURE ()

EXTERNAL NAME 'HELLO'
EXTERNAL NAME 'HELLO!HELLO'
EXTERNAL NAME '/home/db2inst/sqllib/function/HELLO.so'
EXTERNAL NAME '/home/db2inst/sqllib/function/HELLO.so!HELLO'

LANGUAGE COBOL
PARAMETER STYLE SQL

But when I try to call procedure from DB2 I always get something like
this:

Routine "PROCEDURE" (specific name "SQL090630090438500") is
implemented with code in library or path ".../sqllib/function/HELLO",
function ".../sqllib/function/HELLO" which cannot be accessed. Reason
code: "4".. SQLCODE=-444, SQLSTATE=42724, DRIVER=4.7.89
Routine "PROCEDURE" (specific name "SQL090630091203800") is
implemented with code in library or path ".../sqllib/function/HELLO",
function "HELLO" which cannot be accessed. Reason code: "4"..
SQLCODE=-444, SQLSTATE=42724, DRIVER=4.7.89
Routine "PROCEDURE" (specific name "SQL090630091347500") is
implemented with code in library or path ".../sqllib/function/
HELLO.so", function ".../sqllib/function/HELLO.so" which cannot be
accessed. Reason code: "4".. SQLCODE=-444, SQLSTATE=42724,
DRIVER=4.7.89
Routine "PROCEDURE" (specific name "SQL090630091711000") is
implemented with code in library or path ".../sqllib/function/
HELLO.so", function "HELLO" which cannot be accessed. Reason code:
"4".. SQLCODE=-444, SQLSTATE=42724, DRIVER=4.7.89

Where is the problem ? What should I pass as EXTERNAL NAME? Or what
should I put extra to directory /home/db2inst1/sqllib/function ?

Any help will be appreciated...

Best regards
Melmack

BTW: Stored procedures written in Java work fine in this
configuration.


Below I attach environment info:

$ db2level
DB21085I Instance "db2inst1" uses "32" bits and DB2 code release
"SQL09070"
with level identifier "08010107".
Informational tokens are "DB2 v9.7.0.0", "s090521", "LINUXIA3297", and
Fix Pack
"0".
Product is installed at "/opt/ibm/db2/V9.7".

$ db2licm -l
Product name: "DB2 Express-C"
License type: "Unwarranted"
Expiry date: "Permanent"
Product identifier: "db2expc"
Version information: "9.7"
Max number of CPUs: "2"
Max amount of memory (GB): "2"


$cat /proc/version
Linux version 2.6.26.8-57.fc8 (mock...@x86-3.fedora.phx.redhat.com)
(gcc version 4.1.2 20070925 (Red Hat 4.1.2-33)) #1 SMP Thu Dec 18
19:19:45 EST 2008

Larry

unread,
Jun 30, 2009, 3:02:27 PM6/30/09
to
Do you have a COBOL compiler?

Larry E.

melmack

unread,
Jul 2, 2009, 4:46:07 PM7/2/09
to

>
> Do you have a COBOL compiler?
>
> Larry E.

Yes. I'm working with TinyCOBOL v 0.64

Best regards
Melmack

Larry

unread,
Jul 2, 2009, 10:54:46 PM7/2/09
to
Don't know if that is a supported COBOL for DB2, but have you followed
the guidance on how to build COBOL routines in the doc?

Chapter 7 in:

ftp://ftp.software.ibm.com/ps/products/db2/info/vr95/pdf/en_US/db2a2e952.pdf

Larry Edelstein

Jan M. Nelken

unread,
Jul 2, 2009, 11:49:31 PM7/2/09
to
melmack wrote:

...


> File has been compiled to executable, static library and shared
> library with TinyCOBOL compiler -> results are accordingly HELLO,
> HELLO.a, HELLO.so.

...


> DB21085I Instance "db2inst1" uses "32" bits and DB2 code release
> "SQL09070"
> with level identifier "08010107".
> Informational tokens are "DB2 v9.7.0.0", "s090521", "LINUXIA3297", and
> Fix Pack
> "0".
> Product is installed at "/opt/ibm/db2/V9.7".

As per DB@ UDB V9.7 online documentation available at:

http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp

supported environment for COBOL routines is:

For this OS:
- Linux� on x86 (32-bit DB2 instances and compilers only)

supported compilers are:

* Micro Focus COBOL Server Express Version 4.0 with Service Pack 2 on SLES9
* Micro Focus COBOL Server Express Version 4.0 with Service Pack 2 on RHEL4
* Micro Focus Server Express, Version 5.0
* Micro Focus does not offer support on SLES11

See:

http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/topic/com.ibm.db2.luw.apdv.gs.doc/doc/r0023470.html


Jan M. Nelken

0 new messages