By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,590 Members | 2,191 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,590 IT Pros & Developers. It's quick & easy.

Problem with UDF

P: n/a
In our software we use an UDF since 1997. Now, after creating the
complete software, this UDF doesn't run. It gives the error message

db2 => values (lzgneu.bitand (5, 7))
1
-----------
SQL0430N User defined function "LZGNEU.BITAND" (specific name
"SQL050628151206273") has abnormally terminated. SQLSTATE=38503

This is the definition:

#include <sqludf.h>

#include <export.h>
#include <implement.h>

void SQL_API_FN bitand (
SQLUDF_INTEGER *operator1,
SQLUDF_INTEGER *operator2,
SQLUDF_INTEGER *out,
SQLUDF_SMALLINT *operator1_null,
SQLUDF_SMALLINT *operator2_null,
SQLUDF_SMALLINT *outnull,
SQLUDF_TRAIL_ARGS)
{
*out = *operator1 & *operator2;
*outnull = 0;
} /* bitand */

Really mysterious is, that the function bitor, which is the same, only
the operator "&" is replaced with "|", is working as in the past 8
years.

The error occurs on AIX 4.x running DB2 V7. On Linux with DB2 V8.2 it's
running OK.

What can we do?

Regards,
--
Burkhard Schultheis
Tele Data Electronic, Wagnerstr. 10, D-76448 Durmersheim
Email: sc********@tde-online.de
Phone: +49 7245 9287-21
Nov 12 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Burkhard Schultheis wrote:
In our software we use an UDF since 1997. Now, after creating the
complete software, this UDF doesn't run. It gives the error message

db2 => values (lzgneu.bitand (5, 7))
1
-----------
SQL0430N User defined function "LZGNEU.BITAND" (specific name
"SQL050628151206273") has abnormally terminated. SQLSTATE=38503

This is the definition:

#include <sqludf.h>

#include <export.h>
#include <implement.h>

void SQL_API_FN bitand (
SQLUDF_INTEGER *operator1,
SQLUDF_INTEGER *operator2,
SQLUDF_INTEGER *out,
SQLUDF_SMALLINT *operator1_null,
SQLUDF_SMALLINT *operator2_null,
SQLUDF_SMALLINT *outnull,
SQLUDF_TRAIL_ARGS)
{
*out = *operator1 & *operator2;
*outnull = 0;
} /* bitand */


What's the statement you used to register the function in your database?
(The code looks quite good to me, except that I would have used
"SQLUDF_NULLIND" instead of "SQLUDF_SMALLINT" - but that's not an issue
here.)

--
Knut Stolze
Information Integration Development
IBM Germany / University of Jena
Nov 12 '05 #2

P: n/a
Knut Stolze schrieb:

What's the statement you used to register the function in your database?
(The code looks quite good to me, except that I would have used
"SQLUDF_NULLIND" instead of "SQLUDF_SMALLINT" - but that's not an issue
here.)


db2 "CREATE FUNCTION lzgneu.bitand (INT, INT)
RETURNS INT EXTERNAL
NAME '$HOME/lib/function/bitand'
LANGUAGE c
PARAMETER STYLE db2sql
NOT VARIANT
NO SQL
NO EXTERNAL ACTION"

Now we tried an old binary bitand. It works. Why is the new one not able
to function?

Regards,
--
Burkhard Schultheis
Tele Data Electronic, Wagnerstr. 10, D-76448 Durmersheim
Email: sc********@tde-online.de
Phone: +49 7245 9287-21
Nov 12 '05 #3

P: n/a
Burkhard Schultheis schrieb:
Knut Stolze schrieb:
What's the statement you used to register the function in your database?
(The code looks quite good to me, except that I would have used
"SQLUDF_NULLIND" instead of "SQLUDF_SMALLINT" - but that's not an issue
here.)

db2 "CREATE FUNCTION lzgneu.bitand (INT, INT)
RETURNS INT EXTERNAL
NAME '$HOME/lib/function/bitand'
LANGUAGE c
PARAMETER STYLE db2sql
NOT VARIANT
NO SQL
NO EXTERNAL ACTION"

Now we tried an old binary bitand. It works. Why is the new one not able
to function?


Now it's solved. It was the call for the linker. We tried a linker call
for both Linux and AIX. It is working for shared libraries, but not for
the UDF's. Now we use the old call in the Makefile for the UDF's.

Regards,
--
Burkhard Schultheis
Tele Data Electronic, Wagnerstr. 10, D-76448 Durmersheim
Email: sc********@tde-online.de
Phone: +49 7245 9287-21
Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.