Article ID: 49730
Article Last Modified on 12/1/2003
APPLIES TO
- Microsoft FORTRAN Compiler 4.0
- Microsoft FORTRAN Compiler 4.01
- Microsoft FORTRAN Compiler 4.1
- Microsoft FORTRAN Compiler 5.0
- Microsoft FORTRAN Compiler 5.1
- Microsoft FORTRAN Compiler 4.1
- Microsoft FORTRAN Compiler 5.0
- Microsoft FORTRAN Compiler 5.1
- Microsoft FORTRAN PowerStation 1.0 Standard Edition
- Microsoft Fortran PowerStation 1.0a for MS-DOS
- Microsoft FORTRAN PowerStation 32
- Microsoft FORTRAN PowerStation 32
This article was previously published under Q49730
SYMPTOMS
Compiling an application which has a DATA statement that precedes an integer declaration causes the compiler to generate the following error:
CAUSE
The application contains a DATA statement that is not specified in the correct order. According to page 48 of the Microsoft FORTRAN "Reference" manual for versions 5.0 and 5.1, "All specification statements must precede all DATA statements, statement-function statements, and executable statements."
RESOLUTION
To address this error, modify the source code to place the statements in the proper order. The table on page 47 of the Reference manual provides the required statement order for code to compile correctly. The text below provides four rules for using the DATA statement:
- The DATA statement must follow COMMON, DIMENSION, EQUIVALENCE, EXTERNAL, INTRINSIC, and SAVE instructions.
The DATA statement can work in conjunction with the following:
Executable statements Statement function statements ENTRY and FORMAT statements All metacommands except the following: $DO66, $[NO]FLOATCALLS $[NO]FREEFORM $STORAGE
- The DATA statement must follow every other command.
- The DATA statement must precede the END instruction.
NOTE: In the Fortran PowerStation 4.0 manual, page 27, the same comment regarding DATA statement placement after type declaration specifiers exists, however this statement is incorrect for Fortran PowerStation 4.0. The order of statements table on page 26 correctly indicates that type declaration statements can occur after DATA statements. The FORTRAN 90 standard allows the mixed-use of type declaration statements and DATA statements, as long as, type declaration statements are declared before they are used in DATA statements.
MORE INFORMATION
The following code example demonstrates the F2836 "statement out of order error" because a DATA statement precedes an integer declaration statement.
Sample Code
C Code options required: None INTEGER N DATA N /1/ INTEGER M END
Additional query words: 4.00 4.01 4.10 5.00 5.10 1.00 1.00a
Keywords: kberrmsg kblangfortran KB49730