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

ID: Q108366


The information in this article applies to:
  • Microsoft FORTRAN for MS-DOS, versions 5.0, 5.1
  • Microsoft FORTRAN for OS/2, versions 5.0, 5.1
  • Microsoft FORTRAN PowerStation for MS-DOS, versions 1.0, 1.0a
  • Microsoft Fortran Powerstation 32 for Windows NT, version 1.0


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 :
Version : :1.0,1.0a,5.0,5.1
Platform :
Issue type :


Last Reviewed: November 2, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.