Knowledge Base

FIX: Nested $IF Statements with $ELSE Cause F2830 Error

Article ID: 108366

Article Last Modified on 12/1/2003


APPLIES TO


This article was previously published under Q108366

SYMPTOMS

An attempt to compile a program that contains nested $IF compiler conditions with $ELSE clauses may fail to produce the expected result. The compiler may generate the error:
error F2830: END missing

CAUSE

When there is a $ELSE following a $ENDIF and the outer $IF condition is met making the condition false, the compiler fails to parse for any metacommands following the $ELSE including the $ENDIF that terminates the outer $IF block.

STATUS

Microsoft has confirmed this to be a problem in Microsoft FORTRAN PowerStation 32 for Windows NT, version 1.0 and MS-DOS versions 1.0 and 1.0a. This problem was fixed in FORTRAN PowerStation, version 4.0.

MORE INFORMATION

The sample code below illustrates the problem:

Sample Code

C Compile options needed: none
$define first
      subroutine test
$if defined (first)
$if defined (second)
$endif
$else
$endif
      return
      end
				

Additional query words: 1.00 1.00a

Keywords: kbfix KB108366