$IF Statement Example (Micro Focus Conditional Compilation)

The $IF statement can be used to "conditionally compile" portions of your source code. In the following example, if the program is compiled with the directives:


then at compile time, the word "NO" will be displayed and the object code will include an EVALUATE rather than a GO TO statement. If the MF directive were not set, "Not MF dialect" would also be displayed.

$if WHERE = "PC"
     evaluate test-field
       when 5  perform test-a
$if OTHER-CONSTANT defined
$display Program compiled with other-constant set
$display NO
     go to test-a test-b depending on test-field
$if NOMF set
$display Not MF dialect