Microsoft KB Archive/71313

= PRB: F2414: Initializing Substrings in DATA Statements =

Article ID: 71313

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

-



This article was previously published under Q71313



SYMPTOMS
Using Microsoft FORTRAN to compile a program that attempts to initialize substrings using an implied-DO list in a DATA statement may result in the following error messages:

error F2414: (string name) : DATA : not array-element name warning F4400: DATA : more constants than names



CAUSE
This is not a problem with the compiler. The ANSI 77 Standard prohibits the use of implied-DO loops in DATA statements for anything but arrays. Character substrings are not considered arrays.



RESOLUTION
Possible solutions to suppress the F2414 and F4400 error messages are:


 * 1) Initializing the list of substring array elements individually instead of using an implied-DO list in the DATA statement.
 * 2) Initializing the whole string variable instead of a substring when using an implied-DO list in the DATA statement.
 * 3) Initializing substring array elements individually with assignment statements.



MORE INFORMATION
The following program produces the F2414 and F4400 error messages: character*2 a(2) data (a(i)(2:2),i=1,2) /'1','2'/ write(*,*) a(1) end The following sample programs illustrate possible solutions to suppress the F2414 and F4400 error messages:

  Initializing the list of substring array elements individually in the DATA statement. character*2 a(2) data a(1)(2:2), a(2)(2:2) /'1','2'/ write(*,*) a(1) end   Initializing the whole string variable in the DATA statement. character*2 a(2) data (a(i),i=1,2) /' 1',' 2'/ write(*,*) a(1) end   Initializing substring array elements individually with assignment statements. character*2 a(2) a(1)(2:2) = '1' a(2)(2:2) = '2' write(*,*) a(1) end 

Additional query words: 5.00 5.10 1.00

Keywords: KB71313

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.