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





The only other way I have seen it done is by a "/if
defined(TheFollowingIsCommentedOut) and /Endif" statements.  Is there
another way to do it?

I don't understand why you wouldn't want to use that technique. It accomplishes the same thing as /* and */, in a very simple, efficient manner.

Sure, you could use the editor's capability to insert "//" in front of every line of code -- that's not hard to do -- but it's a pain when it comes time to re-enable the code. with IF DEFINED it can be easily enabled/disabled.

For example, do something like this:

   /if defined(EXPERIMENTAL_CODE)

   ... all of "commented out" code is here

   /endif

Assuming that "EXPERIMENTAL_CODE" isn't defined, the code will be ignored by the compiler, and therefore won't be compiled into the program.

If you like, you can even enable it on a per-compile basis by doing this:

    CRTBNDRPG PGM(MYPROGRAM) DEFINE(EXPERIMENTAL_CODE)

You can create any "if defined" condition name that you like. I often have programs like "/if defined(EXCLUDE_THIS_CODE)" to make it clear that I intended to disable the code so that the next guy won't be confused about whether to enable/disable the define condition.

Of course, it's also easy to simply delete the /IF and /ENDIF lines if you want to re-enable it permanently.

What is it about this technique that you don't like?

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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.