Starting and Stopping Debugging

The following code can be called to start debug on your AS/400 job. Once debug is started, the job log will contain detailed optimization information about your SQL statements. Use the example for retrieving your job number so that you can get the AS/400 job number. Once you have the job number, you can use the DSPJOB command to display the locks, job log, etc for the job. The following examples are given is VBScript, but could easily be adapted to JSP or Visual Basic.

To Start Debug:

set CON1 = server.createobject("ADODB.Connection")
set CMD1 = server.createobject("ADODB.Command")
/*open the connection */

cmd1.activeconnection = con1
cmd1.commandtext = "call qsys.qcmdexc('strdbg updprod(*yes)',0000000020.00000)"
/* the above starts debug on the as/400 by calling qcmdexc api to execute command

To End Debug:

cmd1.commandtext = "call qsys.qcmdexc('enddbg',0000000006.00000)"