iTP Active Transaction Pages (iTP ATP) Programmer's Guide

Designing and Debugging ATP Applications
iTP Active Transaction Pages (iTP ATP) Programmer’s Guide522292-002
6-5
Setting Breakpoints
Setting Breakpoints
Stop execution of your script at any point in either of the following ways:
Use atp.quit(). To make sure the browser first displays the output, call
atp.print before quitting:
atp.print('</td></tr></table>');
Move the </server> tag to the point where you want execution to stop. The
browser will display the subsequent code as text.
Debugging Scripts that Use SQL
The following guidelines apply to applications that use NonStop SQL:
Check the sqlcode after instantiating or invoking a method of an atp.SQL
object.
Check the error property of atp.transaction objects.
If, after using the atp.SQL execute() method for a SELECT statement, the
application failed to retrieve the first row of an SQL table, insert a call to the
next() method after the call to execute(). For a SELECT statement, the
execute() method does not automatically retrieve the first row.
Verify that the application invokes methods against the intended atp.SQL objects.
Copying and pasting code within a script can reduce typing errors but can also
introduce unintended duplication.
When using transaction objects, commit changes explicitly. Transactions are rolled
back by default.
If other techniques do not pinpoint an SQL problem, invoke the dumpSQL method
on the atp.SQL object. That method dumps the cache; the dump includes the
number of statements, whether the cache is full, and other information of potential
interest to Support personnel.
Example 6-3. Function to Print Values of Request Variables
function doDump() {
for (i=0; i<atp.request.variables.length; i++) {
print("+ atp.request.variables[i]"+':'+
atp.request[atp.request.variables[i]]+'<br>');
}
atp.quit(1);
}
if (secureAction &&atp.request.Action =="Find") {
//doDump ();
set_gvals_find ();
gFormName ='PCL';
}