Total Pageviews

Debugging Techniques in SQR



Debugging of a SQR program can be done in many ways. They are


·   Using SHOW /DISPLAY command

·   Using Compiler directives

·   Using command line FLAGS 

  SHOW /DISPLAY command 


1) SHOW/DISPLAY Commands can be used any where expect in SETUP section

2) SHOW/DISPLAY Commands show the text and variable information on the screen and at the same time they redirect their information to log file

3) Difference between these two commands is SHOW can capable of showing more than one variable at a time. But DISPLAY command can be used to show only one variable at a time. See the following example

   Using SHOW
















Using DISPLAY













 



Log file looks like














Compiler directives  

 1) Combination of  #debug & -debug , Its used at the time of testing of a particular SQR program 

2) Any thing that follows #debug in the program needs to have -debug in the command line flags to compile further , #debug can be appended more than one number or letter its like 
          
            #Debugx show 'Program started'

        -> This statement can be compiled only when -Debugx is specified in flags 

     #Debug    Show  'Select statement started'

        #Debuga  Show  'Employee Id '
        #Debugb  Show  'Employee Name'

       -> This statement can be compiled and information from SHOW can be printed in log file  if and only if the command line contains this flag -Debugab

3) Other compiler directives are 
        
          #Ifdef / #End-If 
          #Ifndef / #End-If
          #If / #Else / #End-If

These directives can be used to track the entire sections of code .This gives very clear idea in debugging 

 #Ifdef / #End-If










In above part of coding we are able to track the complete section of code .This looks likes in the following way in the log file. Make sure that you have placed -debugx flag in the command line options .As I am running from process scheduler I have made the changes in Process(PeopleTools ->Process Scheduler)












Log file looks like





Using Command line Flags:

In addition to these , Some of the command line flags are very useful while in debugging . They are 


Flags
Purpose
-S
It shows the complete SQL statement status. It returns the following information
·         Text of each SQL statement
·         No of times compiled and executed
·         No of rows selected
-E
Creates the separate log file with the extension of .err of program name. Stores in the same path of program
-C
Create the cancel dialogue box
-Tnn
Only nn pages will be printed .
 





 

2 comments: