MF 

$IF Statement

A $IF statement provides the means whereby selected parts of the source text are not included in the compilation.

General Formats for Format 1


$IF constant-name-1 [NOT] [ < or > = ] literal-1

General Formats for Format 2


$IF constant-name-2 [NOT] DEFINED

General Formats for Format 3


$IF directive-setting SET

Syntax Rules

  1. Constant-name-1 is defined by a level 78 entry or a CONSTANT Compiler directive.
  2. If literal-1 is numeric, it must be zero or a positive integer.
  3. Directive-setting is specified in the same format as it is given in a $SET statement and may be preceded by NO. However, the format used in the $IF statement differs from the format used in the $SET statement as follows:
    1. No spaces are permitted between the NO and directive name
    2. Hyphens in the directive must be specified exactly
    3. If the directive has a parameter it may be omitted
  4. Only directives used in the syntax-check phase and produced in the directive settings list (see compiler directive SETTINGS) may be specified for directive-setting
  5. The whole statement must appear on a single line.
  6. $IF can be nested within another $IF.

General Rules

  1. Constant-name-2 is DEFINED if it is the subject of a level 78 entry or a CONSTANT Compiler directive, otherwise it is NOT DEFINED.
  2. Directive-setting SET evaluates true if the given setting matches the actual directive setting. If a parameter is specified then it must also match.
  3. The comparison between Directive-setting and the actual directive setting is not case sensitive.
  4. If the condition evaluates true the source lines following the $IF statement are processed. If the condition evaluates false, COBOL source lines are ignored until the next Micro Focus conditional compilation line is encountered.

Examples

  1. An example of using Micro Focus conditional compilation is provided in the topic $IF Statement (Micro Focus Conditional Compilation).