PCL and Customization > The PATRAN Command Language (PCL) Introduction > Finding Programming Errors with PCL
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX''">XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX''">   
Finding Programming Errors with PCL
There are two features in PCL that track the PCL program as it is processed: TRACE and DEBUG. These “Debugging tools” can be very useful when finding and correcting errors in the program logic. The first of these tools is the TRACE directive.
Trace Directive
The TRACE directive allows specification of tracing options during execution of PCL functions. The TRACE should normally be set to NONE. There are three options that can be enabled in TRACE; they are CALLS, EXITS, and LINES. When CALLS is set, each time a PCL function is called, a message is output. When EXITS is set, messages are output when PCL functions return control to their calling functions. When LINES is set, the current statement numbers are displayed as a function executes. In addition, if DEBUG was ON when the function was compiled, the source statements themselves will be displayed when LINES is set. The format of the TRACE directive is:
!! 	TRACE NONE	(disable tracing)
!! 	TRACE CALLS	(enable tracing of function calls)
!! 	TRACE NOCALLS	(disable tracing of function calls)
!! 	TRACE EXITS	(enable tracing of function exits)
!! 	TRACE NOEXITS	(disable tracing of function exits)
!! 	TRACE LINES	(enable tracing of function statements)
!! 	TRACE NOLINES	(disable tracing of function statements)
.
.
.
 
!! 	TRACE CALLS LINES
!! 	TRACE level mask is CALLS NOEXITS LINES
.
.
.
Debug Directive
The second directive that is useful for debugging PCL programs is the DEBUG directive. The DEBUG directive allows specification of a debugging flag which affects future compilations. With DEBUG ON, the original source lines of the file are compiled into the function. This allows the TRACE command to display the source during execution. The DEBUG option should only be used during development as it creates much larger and slower code. The format of the DEBUG directive is:
!!	DEBUG ON	(enable DEBUG lines during compile)
!!	DEBUG OFF	(disable DEBUG lines during compile)
Don't forget to set TRACE to LINES when using the debug mode or compiling the function with DEBUG set to ON.
Another feature provided by PCL is the DUMP command. The format of the DUMP command is:
DUMP variable
Where variable is any currently declared variable.
When the DUMP statement is encountered during execution of any PCL function, the contents of the variable is displayed in the alpha buffer. For an example, we examine the variable xyz by putting the following statement in function NX.
   DUMP xyz
When the function NX is executed with a node located at the x=1,y=0,z=0 location, the following is displayed in the alpha buffer:
Array: ( 3 )
Data: 1.0, 0.0, 0.0