FORTRAN Reference Manual

Compiler Directives
FORTRAN Reference Manual528615-001
10-38
IFNOT Compiler Directive
Once you have initiated skipping of source text using an IFNOT directive, source
lines are skipped until the next matching ENDIF. Thus, the way to write an if-then-
else decision structure is:
?IF n
(statements to be compiled if toggle n is set)
?ENDIF n
?IFNOT n
(statements to be compiled if toggle n is reset)
?ENDIF n
The compiler prints source lines skipped as a result of an IFNOT directive in the
source text listing with a “#” character to the left of the line.
Example
In the following example, the RESETTOG directive instructs the compiler to compile
code C. If you use a RESETTOG 2 and RESETTOG 3 directive, FORTRAN compiles
both code A and code B.
?RESETTOG 3
?IFNOT 2
code B
?ENDIF 2
?IFNOT 3
code C
?ENDIF 3