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

Last reviewed: September 16, 1997
Article ID: Q108366
1.00 1.00a | 1.00
MS-DOS      | WINDOWS NT
kbtool kbfixlist kberrmsg

The information in this article applies to:

  • Microsoft FORTRAN for MS-DOS, versions 5.0 and 5.1
  • Microsoft FORTRAN for OS/2, versions 5.0 and 5.1
  • Microsoft FORTRAN PowerStation for MS-DOS, versions 1.0 and 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 reference words: 1.00 1.00a
KBCategory: kbtool kbfixlist kbbuglist kberrmsg
KBSubcategory: FL32Iss
Solution Type : kbfix


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: September 16, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.