473,657 Members | 2,595 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Delphi UDF's

We have just upgraded from UDB DB2 V7.2 to UDB DB2 V8.2 fixpack 12.
We're having problems with UDF's that ran successfully under V7.2 but
are now failing with SQL04030N sporatically. Below is a listing of one
of the UDF's and the associated create function. The UDF is written
using Delphi 6. The UDF doesn't fail at the same point each time you
rerun the process. If anybody has had a similar situation, we'd be
more than interested in your resolution.
Thanks

drop function RIGHTJUSTIFY;
create function RIGHTJUSTIFY (varchar(4000))
returns varchar(4000)
external name 'e:\dmisapp\EWA \Common\Bin\dmi s_funcs!23'
language c parameter style sql
deterministic fenced
no sql
no external action;

procedure RightJustify(aI nStr, aOutStr : pChar; aInNull, aOutNull :
PShort;
aSQLState, aFuncName, aSpecName, aMsgTxt :
pChar); stdcall;
{ Moves all trailing spaces to the front of a string from the tail of
the string.
The length of the string does not change.
eg. RightJustify('3 Spaces ') returns ' 3 Spaces'
}
var
lStr : string;
lCounter : integer;
lTrailingSpaces : integer;
begin
try
if aInNull^ <gi_DB2_NullI nd then // Is aInStr NULL
begin
lStr := String(aInStr);
try
lTrailingSpaces := 0; // Nope, then move spaces to front

for lCounter := length(lStr) downto 1 do //count the number
of trailing spaces
begin
if lStr[lCounter] <' ' then
break
else
inc(lTrailingSp aces);
end; //for

if lTrailingSpaces <0 then //if there were trailing spaces
begin
delete(lStr, length(lstr) - lTrailingSpaces + 1,
lTrailingSpaces );
lStr := StringOfChar(' ', lTrailingSpaces ) + lStr;
end;

aOutStr := Strcopy(aOutStr , pChar(lStr));
aOutNull^ := gi_DB2_Not_Null Ind;
except
aOutNull^ := gi_DB2_NullInd;
end
end
else
aOutNull^ := gi_DB2_NullInd;
except
on E: Exception do
begin
aSQLState := Strcopy(aSQLSta te, pChar(gs_SQLSTA TE_38615));
aMsgTxt := Strcopy(aMsgTxt , pChar(Copy(E.Me ssage,1,70)));
aOutNull^ := gi_DB2_Not_Null Ind;
end;
end;
end;

Aug 7 '06 #1
0 1360

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
4960
by: Sivakumar Shanmugam | last post by:
Group.. We are running on db2 UDF V8 on Sun solaris platform. I created an UDF which calles a C-routine(SQL_API_FN). This C-routine in turn calls an external C-function. The C-function is provided to us by a vendor(PCMILER application). The C-Function does the following operations- Open the server,get distance between two points and close the server. It takes two input parameters(points). Whenever I call UDF via select statement it always...
7
1992
by: Rhino | last post by:
I was reading the DB2 for Linux/Unix/Windows (V7.2) manuals just now to get some background information about UDFs when I came across this: "Note that valuable debugging tools such as printf() do not normally work as debugging aids for your UDF, because the UDF normally runs in a background process where stdout has no meaning. As an alternative to using printf(), it may be possible for you to instrument your UDF with file output logic,...
7
1594
by: Rhino | last post by:
Since I haven't been able to find out yet how to get my Eclipse debugger to step through my Java UDF code, I am adding old-style File I/O debugging to some of my UDFs. I'm not sure of the best way to design this though and am looking for some suggestions. Since my class might contain several UDF methods, for instance, several versions of the same basic UDF but with different signatures for different situations, e.g. count(needle,...
4
1825
by: Rhino | last post by:
I've been playing with Java UDFs for the last couple of days and I've got some questions about scratchpads. I'm running DB2 LUW V8 (FP8) on WinXP. Somewhere in the manuals, I found some remarks that said I could either manage my scratchpad with the getScratchpad() and setScratchpad() methods *OR* set up my own class variables to keep the state between invocations of the UDF. (I can't find those remarks again right now but I know I saw...
6
2056
by: Rhino | last post by:
I am writing Java UDFs using DB2 V8.2 (Fixpack 8) on Windows XP. I would like to create some common code classes that are visible to the UDFs on my system but I'm not having a lot of luck so far. I'm wondering if I'm trying to do the impossible or if my technique is just wrong. One of the common code classes I want to write contains code to open, write and close a flat file that can be used for debugging. I'd like that class to be...
2
3683
by: Rhino | last post by:
I am trying to write a trigger/UDF combination that closely follows the example given in the following DeveloperWorks article: http://www-106.ibm.com/developerworks/db2/library/techarticle/0205bhogal/0205bhogal.html Unfortunately, when my UDF starts to compose the email, something goes wrong and DB2 begins writing to db2diag.log - and writing, and writing, and writing. Millions of lines get written if I don't kill the processes. I've...
6
2433
by: Rhino | last post by:
I'm trying to debug a simple Java UDF written in the DB2General style within Eclipse. I'm getting a java.lang.UnsatisfiedLinkError when I execute the set() method in the UDF. I know that the UnsatisfiedLinkError has something to do with a DLL that is not visible but I'm not sure why I'm having the problem given that both db2java.zip and db2jcc.jar are visible on my classpath and each of them contain the COM.ibm.db2.app.UDF class with a...
2
2409
by: dmitry.sychov | last post by:
Hello, 1) On UDF timeout the timeout error is return to the caller, but what happens with the UDF's thread? - does it terminated via Windows TerminateThread() or db2 engine thread waits for the UDF to finish anyway? 2) another situation: what if UDF enters endless loop or deadlocks - will db2 engine will terminate UDF thread then after timeout?
1
1652
by: dmitry.sychov | last post by:
Hello, A note: by thread i always mean the worker thread on which SP is running on. ok, if there is no UDF execution timeout thing what about the following theme:
0
8397
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8310
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8827
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8732
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7333
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6167
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4158
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4315
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.