×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




Assume that the users can set their WHERE and ORDER BY dynamically at run
time. And at a given time, they complain that the system is slow. I would
like to look at the SQL statement that was built by the program based on
user input. If I could dump that SQL statement into the job log, I can try
and see why certain indexes are missed/omitted by the optimizer, see if I
can give the user's an easier way to filter/sort, look at response times..
and other performance issues. If there was some way to get this info. Only
when the debug mode is on, then all I need to do is to just start a service
job and then issue the STRDBG command.


-----Original Message-----
From: Scott Klement [mailto:klemscot@klements.com]
Sent: Tuesday, July 02, 2002 1:45 PM
To: 'rpg400-l@midrange.com'
Subject: RE: Debug Mode.


On Tue, 2 Jul 2002, Mangavalli, Ramanujam wrote:
>
> Well, if the program is in debug mode, I want to send certain messages
into
> the job log. Say some kind of performance information/SQL
Statements/etc...
>

This is what I use the /if defined, /if not defined, etc compiler
directives are for.   You can include code that is compiled into the
program based on whether certain symbols are defined.

For example, let's say you had a subprocedure called "Log" that you
wanted to call only when you are debugging a program.   You could
put:

     c/if defined(EXTRA_LOGGING)
     c                   callp     Log('SQL statement: ' + SqlStmt)
     c/endif

into your RPG source, and then when you want to debug the program
you'd compile it like this:

    CRTBNDRPG MYPGM DEFINE(EXTRA_LOGGING)

but, when you compile it for use in production, you'd omit the
"DEFINE(EXTRA_LOGGING)" so that the compiler would ignore those
statements.


_______________________________________________
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l
or email: RPG400-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2026 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.