Friday, April 4, 2014

Tracing SQR

SQR being one of the oldest reporting tools used by PeopleSoft, I'm sure most of the experienced PeopleSoft developers knows how to trace an SQR.

I dedicate this post to all newbie developers out there who did not get much exposure to SQR.

So how do one debug an SQR? How do I know what is the value of a particular variable at run time or how do I know if my procedure is being called?

Simple, use display or show statements as shown below.

show statements

and the values would be displayed in the log file.

log

Now, when my reports are run I don't want to clog the log file and confuse the end users. I just want to enable them only when I want to debug any issues.

It's simple. Add #debug command before your show statements. This will enable you to conditionally process the statements.

#debug statements

You may optionally add a debug flag letter next to #debug. Note that I have added #debugd.

To get these values to be shown in log file. Append the following parameter to the SQR process definition (in Override Options) or in command line.
-debug[flag letters]
In the example above I have used the flag letter d, so I would append the following parameter to the process definition.

process definition
 So when I run the report, all statements starting with #debug or #debugd would be compiled and shown in log file.

No comments:

Post a Comment