× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I'm running a test on emailing pdf's. That section of code deletes the spool file after it's sent. I don't want the spool file deleted because for now I want to manually do stuff to it. Once I'm done, I'm removing the if statement.

I'd do one of these things:

Use a DEFINE to wrap around the 'debugging' code and comment it as such. You can then enable the debugging aspects when you compile the code by use of the DEFINE parameter on CRTBNDRPG or CRTRPGMOD. This has the benefit of allowing you to toggle the debugging on or off without changing the source code. It has the disadvantage that you have to compile the program to toggle debugging.

Use an external indicator like U1 to condition the debugging code. This sounds heretical until one realises that one can toggle U1 on without touching the source code or any other program in the call stack. I generally try to use a parameter for this purpose, but sometimes one can't change the calling program to pass the 'debug=y' parameter.

An alternative to that is to consider a standard debugging data area. Put the name of the program to be debug-enabled in it and at run time your program checks to see if it's the one to be debug-enabled or not.

If it seems like a lot of work to go through to avoid changing a few lines of code, or to not do a compilation, let me just say that I've been burnt by compiling a program that someone was in the middle of changing (and the changes were incomplete). That simple compile lead to quite a lot of work to restore the source back to the version of the object in production.

Your mileage may vary, but I thought the ideas might spur some discussion of how others would enable 'debugging' code in their applications.
  --buck

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-2024 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.