473,503 Members | 2,150 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\dmis_funcs!23'
language c parameter style sql
deterministic fenced
no sql
no external action;

procedure RightJustify(aInStr, 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_NullInd 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(lTrailingSpaces);
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_NullInd;
except
aOutNull^ := gi_DB2_NullInd;
end
end
else
aOutNull^ := gi_DB2_NullInd;
except
on E: Exception do
begin
aSQLState := Strcopy(aSQLState, pChar(gs_SQLSTATE_38615));
aMsgTxt := Strcopy(aMsgTxt, pChar(Copy(E.Message,1,70)));
aOutNull^ := gi_DB2_Not_NullInd;
end;
end;
end;

Aug 7 '06 #1
0 1346

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

Similar topics

4
4943
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...
7
1983
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...
7
1585
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...
4
1810
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...
6
2037
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....
2
3669
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:...
6
2420
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...
2
2401
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...
1
1644
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
7205
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,...
0
7093
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...
0
7287
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,...
0
7467
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5594
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,...
1
5022
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...
0
4688
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...
0
3177
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...
0
399
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.