Previous Topic: Display the Executed Source

Next Topic: About Mapping Services

Receive NCL Trace Output

When debugging full screen procedures, the output from the NCLTRACE facility is not available for viewing until the process has completed, or the window has been released by the process. This can be undesirable if the process has been suspended after a panel has been sent and the process still owns the window. The trace output will not be seen until the process releases ownership of the window.

Using the DEBUG SET NCLTRACE=YES profile command, the trace output from a process being debugged will be delivered to the debugger's environment.

Example: Debug Session

The following sequence of commands shows how a debug session could proceed:

DEBUG START WINDOW=2          -* Debug any procedures in
                              -* window 2
DEBUG START USER=NM1BSYS PROCEDURE=MYPROC
                              -* Debug background procedure
                              -* MYPROC in BSYS region
DEBUG SET NEWHOLD=YES         -* Ensure procedure is
                              -* stopped on 1st statement
DEBUG BREAKPOINT PROCEDURE=MYPROC STMT=1250000
                              -* Suspend the procedure if it
                              -* tries to execute statement
                              -* number 1250000
DEBUG BREAKPOINT PROCEDURE=MYPROC VERB=APPC
                              -* Suspend background
                              -* procedure on the first
                              -* APPC verb
DEBUG BREAKPOINT PROCEDURE=MYPROC VARS=WKTRANID DATA=CH22
                              -* Suspend the procedure when
                              -* is sets WKTRANID to the
                              -* data that causes the error
                              -* The procedure MYPROC is started in window 2 and
                              -* is immediately suspended
DEBUG STEP NEXT=10            -* Execute the first 10
                              -* statements
DEBUG DISPLAY VARS=WK* GENERIC
                              -* Verify that the work
                              -* variables have been set
                              -* correctly
DEBUG RESUME-* Let the process continue
                              -* until the first breakpoint
                              -* The procedure is suspended on the APPC verb
DEBUG DISPLAY VARS=WKTRANID   -* The variable has the
                              -* correct value - continue
DEBUG LIST BREAKPOINTS        -* List the current
                              -* breakpoints
DEBUG CLEAR BREAKPOINT=2      -* Clear the breakpoint on
                              -* the APPC verb
DEBUG RESUME                  -* Let the process continue
                              -* until the next breakpoint
                              -* The procedure is suspended after updating WKTRANID to
                              -* CH22
DEBUG DISPLAY VARS=WK* GENERIC-* The display indicates that
                              -* WKTRANPREF was incorrect
DEBUG MODIFY VARS=WKTRANPREF DATA=ZCH
DEBUG MODIFY VARS=WKTRANID DATA=ZCH22
                              -* Fix the variables
DEBUG CLEAR                   -* Clear all the breakpoints
DEBUG BREAKPOINT VARS=WKTRANPREF
                              -* Stop the procedure when
                              -* WKTRANPREF is updated
DEBUG RESUME                  -* Let the process continue
                              -* until the next breakpoint
                              -* The procedure is suspended after updating WKTRANPREF
DEBUG TRACE                   -* Display the nesting
                              -* levels.
                              -* The display indicates that a subroutine was
                              -* called at the wrong place
DEBUG MODIFY VARS=WKAPPPPLCTR DATA=2
                              -* Change the loop counter to
                              -* go through the process again
NCLTRACE ON ID=123-* Set tracing on
DEBUG SET NCLTRACE=YES-* Have the trace output sent
                              -* here
DEBUG STEP NEXT=80-* Check the results
                              -* After seeing the trace, it is clear that the 
                              -* variable WKHSGT is incorrectly set. The source is amended.
                              -* The bug had been found, so stop the debug 
                              -* session and flush the process.
DEBUG STOP TYPE=FLUSH         -* Terminate the debug
                              -* session and flush the
                              -* procedures