ibm-information-center/dist/eclipse/plugins/i5OS.ic.ddp_5.4.0.1/rbal1tdebug.htm

164 lines
11 KiB
HTML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-us" xml:lang="en-us">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="security" content="public" />
<meta name="Robots" content="index,follow" />
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
<meta name="DC.Type" content="reference" />
<meta name="DC.Title" content="Testing and debugging" />
<meta name="abstract" content="Testing and debugging distributed SQL programs is similar to testing and debugging local SQL programs, but certain aspects of the process are different." />
<meta name="description" content="Testing and debugging distributed SQL programs is similar to testing and debugging local SQL programs, but certain aspects of the process are different." />
<meta name="DC.subject" content="application program, testing and debugging, debugging and testing" />
<meta name="keywords" content="application program, testing and debugging, debugging and testing" />
<meta name="DC.Relation" scheme="URI" content="rbal1pdrdp.htm" />
<meta name="DC.Relation" scheme="URI" content="rbal1progref.htm" />
<meta name="DC.Relation" scheme="URI" content="../cl/enddbg.htm" />
<meta name="DC.Relation" scheme="URI" content="../cl/endsrvjob.htm" />
<meta name="DC.Relation" scheme="URI" content="rbal1rdbactv.htm" />
<meta name="DC.Relation" scheme="URI" content="rbal1setddm.htm" />
<meta name="DC.Relation" scheme="URI" content="../cl/strdbg.htm" />
<meta name="DC.Relation" scheme="URI" content="../cl/strsrvjob.htm" />
<meta name="DC.Relation" scheme="URI" content="rbal1stored.htm" />
<meta name="DC.Relation" scheme="URI" content="../cl/sbmrmtcmd.htm" />
<meta name="copyright" content="(C) Copyright IBM Corporation 1998, 2006" />
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 1998, 2006" />
<meta name="DC.Format" content="XHTML" />
<meta name="DC.Identifier" content="rbal1tdebug" />
<meta name="DC.Language" content="en-us" />
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
<link rel="stylesheet" type="text/css" href="./ic.css" />
<title>Testing and debugging</title>
</head>
<body id="rbal1tdebug"><a name="rbal1tdebug"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Testing and debugging</h1>
<div><p>Testing and debugging distributed SQL programs is similar to testing
and debugging local SQL programs, but certain aspects of the process are different.</p>
<div class="section"><p>More than one server will eventually be required for testing.
If applications are coded so that the relational database names can easily
be changed by recompiling the program, changing the input parameters to the
program, or making minor modifications to the program source, most testing
can be accomplished using a single server.</p>
</div>
<div class="section"><p>After the program has been tested against local
data, the program is then made available for final testing on the distributed
relational database network. Consider testing the application locally on the
server that will be the application server (AS) when the application is tested
over a remote connection, so that only the program needs to be moved when
the testing moves into a distributed environment.</p>
</div>
<div class="section"><p>Debugging a distributed SQL program uses the same techniques as
debugging a local SQL program. You use the <span class="cmdname">Start Debug (STRDBG)</span> command
to start the debugger and to put the application in debug mode. You can add
breakpoints, trace statements, and display the contents of variables.</p>
</div>
<div class="section"><p>However, to debug a distributed SQL program, you must specify
the value of *YES for the UPDPROD parameter. This is because <span class="keyword">i5/OS™</span> distributed relational database support uses files
in library QSYS and QSYS is a production library. This allows data in production
libraries to be changed on the application requester (AR). Issuing the <span class="cmdname">Start
Debug (STRDBG)</span> command on the AR only puts the AR job into debug
mode, so your ability to manipulate data on the AS is not changed.</p>
</div>
<div class="section"><p>While in debug mode on the AR, informational messages are entered
in the job log for each SQL statement run. These messages give information
about the result of each SQL statement. A list of SQL return codes and a list
of error messages for distributed relational database are provided in <a href="rbal1problem.htm#rbal1problem">Troubleshooting</a>.</p>
</div>
<div class="section"><p>Informational messages about how the server maximizes processing
efficiency of SQL statements are also issued as a result of being in debug
mode. Because any maximization occurs at the AS, these types of messages will
not appear in the AR job log. To get this information, the AS job must be
put in debug mode.</p>
</div>
<div class="section"><p>A relatively easy way to start debug mode on the server if you
are using TCP/IP is to use the QRWOPTIONS data area. However, you cannot specify
a specific program to debug with this facility. For details on setup, see <a href="rbal1qrwoptions.htm#rbal1qrwoptions">QRWOPTIONS data area usage</a>.
The data area can be used not only to start debug, but to start job traces,
request job logs, display job output and do other things as well. You can
even do the QRWOPTIONS setup on an iSeries™ AR, and have the options shadowed
to an <span class="keyword">iSeries server</span> server. </p>
</div>
<div class="section"><p>If both the AR and AS are <span class="keyword">iSeries server</span>s,
and they are connected with APPC, you can use the <span class="cmdname">Submit Remote Command
(SBMRMTCMD)</span> command to start the debug mode in an AS job. Create
a DDM file as described in the Set up DDM files topic. The communications
information in the DDM file must match the information in the relational database
directory entry for the relational database being accessed. Then issue the
command:</p>
<pre>SBMRMTCMD CMD('STRDBG UPDPROD(*YES)') DDMFILE(ddmfile name)</pre>
</div>
<div class="section"><p>The (<span class="cmdname">SBMRMTCMD</span>) command starts the AS job if
it does not already exist and starts the debug mode in that job. Use one of
the methods for monitoring relational database activity to examine the AS
job log to find the job.</p>
</div>
<div class="section"><p>The following method for putting the AS job into debug mode works
with any AR and a <span class="keyword">DB2 Universal Database™ for iSeries</span> AS
with certain restrictions. It depends on being able to pause after the application
makes a connection to do setup. It also assumes that what you want to trace
or otherwise debug occurs after the connection is established. </p>
<ul><li>Sign on to the AS and find the AS job.</li>
<li>Issue the <span class="cmdname">Start Service Job (STRSRVJOB)</span> command from
the interactive job (the job you are using to find the AS job) as shown: <pre>STRSRVJOB (job-number/user-ID/job-name)</pre>
<p>The
job name for the (<span class="cmdname">STRSRVJOB</span>) command is the name of the
AS job. Issuing this command lets you issue certain commands from your interactive
job that affect the AS job. One of these commands is the <span class="cmdname">Start Debug
(STRDBG)</span> command.</p>
</li>
<li>Issue the (<span class="cmdname">STRDBG</span>) command using a value of *YES for
the UPDPROD parameter in the interactive job. This puts the AS job into debug
mode to produce debug messages on the AS job log.</li>
</ul>
</div>
<div class="section"><p>To end this debug session, either end your interactive job by
signing off or use the <span class="cmdname">End Debug (ENDDBG)</span> command followed
by the <span class="cmdname">End Service Job (ENDSRVJOB)</span> command.</p>
</div>
<div class="section"><p>Because the AS job must be put into debug before the SQL statements
are run, the application might need to be changed to allow you time to set
up debug on the AS. The AS job starts as a result of the application connecting
to the AS. Your application can be coded to enter a wait state after connecting
to the AS until debug is started on the AS.</p>
</div>
<div class="section"><p>If you can anticipate the prestart job that will be used for a
TCP/IP connection before it occurs, such as when there is only one waiting
for work and there is no interference from other clients, you do not need
to introduce a delay.</p>
</div>
</div>
<div>
<ul class="ullinks">
<li class="ulchildlink"><strong><a href="rbal1progref.htm">Program references</a></strong><br />
When a program is created, the <span class="keyword">i5/OS</span> licensed
program stores information about all collections, tables, views, SQL packages,
and indexes referred to in SQL statements in an SQL program.</li>
</ul>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbal1pdrdp.htm" title="When you write a program using SQL, you can embed the SQL statements in a host program.">Prepare distributed relational database programs</a></div>
</div>
<div class="relconcepts"><strong>Related concepts</strong><br />
<div><a href="rbal1rdbactv.htm" title="You can rely on control language (CL) commands, all of which provide similar information, but in different ways, to give you a view of work on an iSeries server.">Monitor relational database activity</a></div>
</div>
<div class="reltasks"><strong>Related tasks</strong><br />
<div><a href="rbal1setddm.htm" title="The implementation of DRDA support on the iSeries server uses Distributed Data Management (DDM) conversations for communications. Because of this, you can use DDM in conjunction with distributed relational database processing.">Set up DDM files</a></div>
</div>
<div class="relref"><strong>Related reference</strong><br />
<div><a href="../cl/enddbg.htm">End Debug (ENDDBG) command</a></div>
<div><a href="../cl/endsrvjob.htm">End Service Job (ENDSRVJOB) command</a></div>
<div><a href="../cl/strdbg.htm">Start Debug (STRDBG) command</a></div>
<div><a href="../cl/strsrvjob.htm">Start Service Job (STRSRVJOB) command</a></div>
<div><a href="rbal1stored.htm" title="The SQL CALL statement is not actually specific to distributed relational databases, but a discussion of it is included here because its main value is in distributing application logic and processing.">SQL CALL statement (stored procedures)</a></div>
<div><a href="../cl/sbmrmtcmd.htm">Submit Remote Command (SBMRMTCMD) command</a></div>
</div>
</div>
</body>
</html>