By console I meant any client app that allows me to query the DB server. For instance, to run sql scripts I am using 'Run Sql Query' app that is part of the iSeries Navigator. I know I can see messages sent from the DB server, in the event of an syntax error for instance. I was wondering if there a way to log messages from inside the stored proc.
As I mentioned in the previous post, AFAIK, DB2 does not provide a feature to write to a file ...
But this is not hard to achieve :
1) If you are writing a stored proc using a prog lang like Java, COBOL, C etc, you can use these programs features to write to a file
2) If you are using a SQL Stored Procedure, you can write a UDF inn one of the above languages which takes the message as the argument and writes that to the file ...
So you can say , select writetofile('Entering Step1') from sysibm.systables ...
Visit the new-look IDUG Website , register to gain access to the excellent content.
"You can view the result set for a stored procedure in Run SQL Scripts by typing in a CALL statement as an SQL statement. The results are available in the results window just like a normal query. If you have multiple results sets, they will each be represented by an additional results tab. Additionally, you can view the output parameters in the Messages tab.
So, if I am specifying the message, variable, etc that I want to see as an output param I can see it after the stored proc is doen running. As a downside, if there are many variables to monitor, the list of param can become a pain to deal with, but it is a decent compromise considering the outcome.