Hi guys,
when we run a stored proc and it results into an unhandled error, the
error message returned by db2 udb does not contain a line number that
caused an error. This makes it pretty difficult to debug those procs.
Line number have always been there in Oracle messages. When I Googled
on this, I saw some people showing DB2 Stored Proc error messages with
line numbers in them (like LINE NUMBER=1285), which makes me believe
that there should be some sort of option to turn inclusion of line
numbers on.
How do I do that?
DB21085I Instance "dbidev02" uses "64" bits and DB2 code release
"SQL08021"
with level identifier "03020106".
Informational tokens are "DB2 v8.1.1.80", "special_13823",
"U800400_13823", and
FixPak "8".
Thanks for your help
Bogdan
Brian Tkatch - 16 Nov 2005 19:02 GMT
A stored PROCEDURE can be compiled with debug information and then run
in debug mode. The DB2 Tools includes Development Center which can
handle this for you.
B.
kangaroo - 17 Nov 2005 15:02 GMT
Thank you Brian. Is there an API of some sort I could use to switch to
debug mode and back programmatically?
Brian Tkatch - 17 Nov 2005 16:15 GMT
I have no idea. The documentation "Application Development Guide:
Programming Server Applications" in Chapter 2 "Developing Routines",
Section "Debugging Routines" says to use the development center.
Watching the code in the center though, it is definitely doing
something. Perhaps someone else can shed some light on the process.
B.
Gert van der Kooij - 17 Nov 2005 16:24 GMT
> I have no idea. The documentation "Application Development Guide:
> Programming Server Applications" in Chapter 2 "Developing Routines",
[quoted text clipped - 4 lines]
>
> B.
There are some articles about debugging at the developers work site.
Serge has written one of them, check the (wrapped) link:
http://www-128.ibm.com/developerworks/db2/library/techarticle/dm-
0409rielau/
Serge Rielau - 18 Nov 2005 06:53 GMT
> I have no idea. The documentation "Application Development Guide:
> Programming Server Applications" in Chapter 2 "Developing Routines",
[quoted text clipped - 4 lines]
>
> B.
To debug a procedure you need to build it in debug mod.
I don't know the API, and unless you are writing a debugger youself it's
a useless peice of knowledge. ;-)
By contrast the tracer works on a procedure as is.
You can look up the C API (if interested) in teh source code of the my
developer works article.
Cheers
Serge

Signature
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
Patrick - 18 Nov 2005 14:40 GMT
Can you provide a link to that article?
Patrick
Serge Rielau - 19 Nov 2005 16:24 GMT
> Can you provide a link to that article?
>
> Patrick
I am blessed with a rare (make that unique AFAIK) name. Easy to google.
Anyway:
http://www-128.ibm.com/developerworks/db2/library/techarticle/dm-0409rielau/
Cheers
Serge

Signature
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
Jan M. Nelken - 19 Nov 2005 17:06 GMT
> Can you provide a link to that article?
>
> Patrick
On top of Serge reply - link was already provided *EXACTLY* 2 posts before!
I could understand the agony in tiresome opening Google search bar or page, but
not checking previous reply two lines above must be something very special.
Jan M. Nelken
Serge Rielau - 17 Nov 2005 23:43 GMT
> Hi guys,
>
[quoted text clipped - 7 lines]
> that there should be some sort of option to turn inclusion of line
> numbers on.
Thsi line-number is maintained by the CREATE PROCEDURE statement.
It is served fro errors in this statement only.
The line-number is passed back through the SQLCA (one of those
overloaded fields. Easy to find when you use UPDATE COMMAND OPTIONS
USING A ON in CLP.
Either way to get line-numbers at runtime use the trace capability
pointed to by Gert. It works on great. :-)
Cheers
Serge

Signature
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab