The DEBUG directive marks blocks of code that are to be processed during the first compilation pass.
DEBUG is one of the directives for conditional preprocessing in PowerBuilder. It is usually added to code only for debugging purposes. Most of the other directives are used only for .NET targets, but you can use the DEBUG directive in standard PowerBuilder targets as well.
The behavior of the DEBUG preprocessor depends on whether the Enable Debug Symbol option in the General page of the Project painter is selected when you test the application. When you run or debug the application in the development environment, the code is always parsed. When you run the executable file, the code is parsed only if the option is selected.
A DEBUG block in a script begins with the instruction, #IF DEFINED DEBUG, and ends with #END IF. These markers must each be on a single line.
You can add an ELSE clause to a DEBUG block. However, in that case the ELSE clause negates the DEBUG condition, so the preprocessor parses its contents differently than the main body of the IF clause. For example:
For example, consider this code:
#if defined DEBUG then /*debugging code*/ #else /* other action*/ #end if
In this example, if you add a breakpoint in the ELSE clause, the breakpoint automatically switches to the /*debugging code*/ line.
Conditional compilation is not supported in DataWindow syntax, structure or menu objects. In source code, conditional compilation blocks that span function, event, or variable definition boundaries are invalid.