PRB: F2414: Initializing Substrings in DATA Statements

Last reviewed: July 18, 1995
Article ID: Q71313
The information in this article applies to:
  • Microsoft FORTRAN for MS-DOS, versions 4.0, 4.01, 4.1, 5.0, and 5.1
  • Microsoft FORTRAN for OS/2, versions 4.1, 5.0, 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

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:

  1. 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
    

  2. 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
    

  3. 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 reference words: 5.00 5.10 1.00
KBCategory: kbtool kberrmsg kbprb
KBSubcategory: FLIss


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: July 18, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.