Home > AS/400 Tips > iSeries administrator tips > Improved SQL source-level debugging in V5R2
iSeries 400 Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

ISERIES ADMINISTRATOR TIPS

Improved SQL source-level debugging in V5R2


Hernando Bedoya
12.24.2002
Rating: -3.67- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


If you're an SQL programmer, you may find that on many occasions you wish to perform program source-level debugging on the SQL routines that you create. Since V4R2, you have been able to do this by using the syntax SET OPTION DBGVIEW = *STMT or *LIST with the CREATE FUNCTION, PROCEDURE, or TRIGGER syntaxes. But the source-level listing you can see in the debugger view is displayed in C-generated codes only, which tends to be quite long and thus difficult to identify the SQL entities of your interest. ISeries programmers wanting to debug these SQL objects soon found that they had to step through the C code generated by DB2 UDB, which is not a pleasant experience for an RPG or Cobol programmer.

To improve the debug process in V5R2, an SQL source-level debugger has been delivered so that the programmer sees and debugs only the SQL statements he coded. The SQL source-level debugger is activated by embedding this SQL statement, SET OPTION DBGVIEW = *SOURCE within the SQL procedure, trigger or function definition. After the routine is created, you can use the OS/400 command:

STRDBG lib/<routine name>
to invoke the source debugger. You can see SQL code debug view by pressing F15 and select "SQL Output View" option.

The following PTFs make the V5R2 SQL *SOURCE debug view for SQL Procedures, functions and triggers available in V5R1:

SI06359
SI06310
SI06358

The original support of the SQL source-level debugger was not available through iSeries Navigator. You had to use a 5250 session for this support. It was also important that you use the OS/400 command RUNSQLSTM to execute the SQL scripts that create the routines (with SET OPTION DBGVIEW = *SOURCE) and then run STRDBG command in that same 5250 session. That is because when the SQL routine was created, its source codes were added as a member (with the same name as the routine's name) into a source file named QSQDSRC, which is always created in QTEMP library.

The debugger then uses this member to display the source codes in the debugger view. That meant, that only the job that created the SQL Procedure, function or trigger could debug it with the more user-friendly *SOURCE debug view because it would disappear as soon as the user signed off.

There is good news: The following PTFs now enable the *SOURCE debug view to be permanently created in the library specified on the associated SQL Create statement. These PTFs also make it much easier to use *SOURCE view with the iSeries Graphical System Debugger when using this tool to debug SQL procedures, functions and triggers:

V5R1 -- SI06814
V5R2 -- SI06652

It is also important that you use OS/400 command RUNSQLSTM to execute the SQL scripts that create the routines (with SET OPTION DBGVIEW = *SOURCE).

To have a look at the iSeries system debugger see the following figure:

Figure 1: The iSeries system debugger.

 

------------------------------
About the author: Hernando Bedoya is an IT Specialist at the International Technical Support Organization (ITSO) in Rochester, Minn. He writes extensively and teaches IBM classes worldwide in all areas of DB2 UDB for iSeries.

==================================
MORE INFORMATION
==================================

  • Debugging and testing programs
    Search400.com member Dean Schweitz says when debugging and testing programs try the RGPLE compile options: OPTION(*SHOWCPY *EXPDDS) DBGVIEW(*LIST).
  • Debugging batch jobs
    Using your interactive screen to debug a batch job submitted to the job queue allows you to put the batch job into debug mode and to set breakpoints without having to change the program to run interactively.
  • Debugging an RPGLE program when its source does not exist
    How can you debug an RPGLE program when its source doesn't exist? Site expert John Kohan tells you.


Rate this Tip
To rate tips, you must be a member of Search400.com.
Register now to start rating these tips. Log in if you are already a member.




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
iSeries system performance and monitoring
Analyze the health of your IBM i server with iScore
Translating Linux for IBM i admins: Working with jobs and networking
Database performance comparisons on IBM i
How to: Monitoring job activity on the AS/400
Performance tuning for IBM i: The basics and beyond
How to: Reduce the percentage of ASP used on the AS/400
Detecting system changes made by outside IP address
AS/400 system values quiz
Checking on System i disk space requires creating a new command: XRTVSYSSTS
Drive space management commands

Systems Management
Can you trust all those trigger programs?
Are your backups complete?
Controlling remote command processing
Watch your profiles
Avoid locking issues
Send message to users at a remote site
Security journal receiver management
Top 10 backup commands
Create an iSeries Access image and update it with the latest Service Pack
Tracking critical file access in real time

DB2 UDB for iSeries
Expert advice on DB2
Make your database easy to read
Top 10 tips from our experts
DB2 expert Kent Milligan offers advice
Schedule stored procedures in DB2 UDB
Special features make creating tables simple
How to use DB2's cross-reference files to help manage your database -- Part II
How to use DB2's cross-reference files to help manage your database -- Part I
Revisit your database naming conventions
DB2/400 and DB2 UDB

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
CIW  (Search400.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



iSeries Security - Security Tools, Physical Security and System Security
HomeNewsTopicsITKnowledge ExchangeTipsBlogsAsk the ExpertsMultimediaWhite PapersProducts
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts