Re: Debug for Stored Procs
Posted in 1995
Topics: Stored Procedures & SPL, Connectivity: ESQL/C, 4GL & Embedded SQL
I'm sure you've received many replies on the use of the TRACE
statement.
One tip I have found useful, especially with programs that call many
stored
procedures, and procedures that call other procedures themselves.
Set your debug file and turn trace on once at the start of your program
rather
turn it on each time in every procedure. This reduces the number of
output
files and makes it easier to turn trace on and off for your entire
program.
I usually create a "startup" procedure that sets isolation and lock
timeout, and
given the appropriate passed argument, will turn on trace.
create procedure startup(dotrace int)
if (dotrace = 1) then
set debug file to "/tmp/myprog.trc";
trace on;
end if;
<other startup SPL>
end procedure
In an ESQL/C program, just call
$int dotrace;
$execute procedure startup($dotrace);
in your program, with dotrace set externally via argv or an environment
var.
Hope it helps.
Dave M.