Fortran Syntax Error In Data Statement
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings syntax error in data declaration at 1 fortran and policies of this site About Us Learn more about Stack Overflow unterminated character constant the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation syntax error in argument list fortran Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; fortran unterminated character constant it only takes a minute: Sign up Syntax error in DATA statement up vote 0 down vote favorite I have this code in a Fortran project: ITEGER IV, IY DIMENSION IV(NTAB,IDEPTH) DIMENSION IY(IDEPTH) DATA IV,IY /(IDEPTH*NTAB)*0,IDEPTH*0)/ Attempting to compile the project generates this error: DATA IV,IY /(IDEPTH*NTAB)*0,IDEPTH*0)/ 1 Syntax error in DATA statement at (1). This worked under f77/g77 (gcc
Unexpected Data Declaration Statement At (1)
4.1), but a recent upgrade has moved us to gcc 4.4 and gfortran. Now this code is causing errors but I just can't see the problem. fortran gfortran fortran77 g77 share|improve this question edited Mar 30 '15 at 20:14 Alexander Vogt 13.1k122448 asked Mar 30 '15 at 19:54 brightwellcd 4216 There are multiple typos in your code... Please fix them! –Alexander Vogt Mar 30 '15 at 20:10 add a comment| 1 Answer 1 active oldest votes up vote 2 down vote accepted My guess is that this was an extension to the Standard, which is not supported any more. The FORTRAN 77 Standard, ch. 9.1 states that the repeat value shall be a nonzero, unsigned, integer constant or the symbolic name of such a constant. As such, the IDEPTH*NTAB is not allowed as repeat value. You can circumvent this by using another constant that constitutes the product: PROGRAM test INTEGER IV, IY INTEGER,PARAMETER :: NTAB=1,IDEPTH=1 INTEGER,PARAMETER :: PROD=NTAB*IDEPTH DIMENSION IV(NTAB,IDEPTH) DIMENSION IY(IDEPTH) DATA IV,IY /PROD*0,IDEPTH*0/ END Or, to make it strictly FORTRAN 77 compliant: PROGRAM test
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting
Fortran Line Continuation
ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Fortran Error Meanings up vote 2 down vote favorite I have been following books and PDFs on writing in FORTRAN to write an integration program. I compile the code with gfortran and get several copies of the http://stackoverflow.com/questions/29355067/syntax-error-in-data-statement following errors. 1)Unexpected data declaration statement at (1) 2)Unterminated character constant beginning at (1) 3)Unclassifiable statement at (1) 4)Unexpected STATEMENT FUNCTION statement at (1) 5)Expecting END PROGRAM statement at (1) 6)Syntax error in data declaration at (1) 7)Statement function at (1) is recursive 8)Unexpected IMPLICIT NONE statement at (1) I do not know hat they truly mean or how to fix them, google search has proven null and the other topics on this site we about other errors. for Error 5) i http://stackoverflow.com/questions/13354510/fortran-error-meanings put in Program main and end program main like i might in C++ but still got the same result. Error 7) makes no sense, i am trying for recursion in the program. Error 8) i read implicit none was to prevent unnecessary decelerations. Ill post the code itself but i am more interested in the compiling errors because i still need to fine tune the array data handling, but i cant do that until i get it working. Program main implicit none real, dimension(:,:), allocatable :: m, oldm real a integer io, nn character(30) :: filename real, dimension(:,:), allocatable :: alt, temp, nue, oxy integer locationa, locationt, locationn, locationo, i integer nend real dz, z, integral real alti, tempi, nuei, oxyi integer y, j allocate( m(0, 0) ) ! size zero to start with? nn = 0 j = 0 write(*,*) 'Enter input file name: ' read(*,*) filename open( 1, file = filename ) do !reading in data file read(1, *, iostat = io) a if (io < 0 ) exit nn = nn + 1 allocate( oldm( size(m), size(m) ) ) oldm = m deallocate( m ) allocate( m(nn, nn) ) m = oldm m(nn, nn) = a ! The nnth value of m deallocate( oldm ) enddo ! Decompose matrix array m into column arrays [1,n] write(*,*) 'Enter Column Number for Altitude' read(*,*) locationa write(*,*) 'Enter Column Number for Temperature' read(*,*) locationt write(*,*) 'Enter Column Number for Nuetral Density' read(*,*) locationn wri
HCL Search Reviews Search ISOs Go to Page... LinuxQuestions.org > Forums > Non-*NIX Forums > Programming gfortran: Syntax error in DATA statement at (1) User Name Remember Me? Password Programming This forum is for all programming questions. The http://www.linuxquestions.org/questions/programming-9/gfortran-syntax-error-in-data-statement-at-1-a-762221/ question does not have to be directly related to Linux and any language is fair game. Notices Welcome to LinuxQuestions.org, a friendly and active Linux Community. You are currently viewing LQ as a guest. By joining our community http://theory.cm.utexas.edu/forum/viewtopic.php?t=807 you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today! Note that registered syntax error members see fewer ads, and ContentLink is completely disabled once you log in. Are you new to LinuxQuestions.org? Visit the following links: Site Howto | Site FAQ | Sitemap | Register Now If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here. Having a problem logging in? Please visit this page to clear all LQ-related cookies. Introduction to Linux - A Hands syntax error in on Guide This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter. For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own. Click Here to receive this Complete Guide absolutely free. Search this Thread 10-15-2009, 05:24 PM #1 science_guy LQ Newbie Registered: Sep 2009 Posts: 3 Rep: gfortran: Syntax error in DATA statement at (1) Hi, I am relatively new to fortran. I am trying to compile a fortran software which has multiple fortran programs, majority of which are Fortran 77 and few are written in Fortran 90. I only have access to the gfortran compiler to run the code. When I use the 'make' command, I get the following error: dkfrwn_0599.f:833.72: data hk13h2o / 0.874946 , 0.028572 , 0.067003 , 0.021822 , 0.00765 1 Error: Syntax error in DATA statement at (1) dkfrwn_0599.f:1111.72: data hk11h2o
Board index Code Bader Search Compilation problem when multipole_mode.f90 is included Bader charge density analysis Moderator: moderators Post Reply Print view Search Advanced search 3 posts • Page 1 of 1 swarup Posts: 2 Joined: Sat Feb 05, 2011 11:51 am Compilation problem when multipole_mode.f90 is included Quote Postby swarup » Mon Feb 07, 2011 5:06 pm Dear SirTo calculate the dipole moment in each bader's volume, I uncommented the line "IF (opts%dipole_flag) CALL multipole()" in main.f90. Then I tried to compile the source code including the multipole_mode.f90 in the Makefile. I used ifort compiler for this. I could compile the code if I don't modify anything but with the above mentioned modification, it is giving the following error message. gfortran -O2 -c multipole_mod.f90multipole_mod.f90:32.22: SUBROUTINE multipole() 1Error: MODULE attribute of 'multipole' conflicts with PROCEDURE attribute at (1)multipole_mod.f90:34.32: REAL(q2),DIMENSION(3,3) :: B 1Error: Unexpected data declaration statement in CONTAINS section at (1)multipole_mod.f90:35.45: REAL(q2),DIMENSION(3) :: dv,v,ringf,shift 1Error: Unexpected data declaration statement in CONTAINS section at (1)multipole_mod.f90:36.42: INTEGER :: i,atom,nx,ny,nz,tenths_done 1Error: Unexpected data declaration statement in CONTAINS section at (1)multipole_mod.f90:37.33: INTEGER :: cr,count_max,t1,t2 1Error: Unexpected data declaration statement in CONTAINS section at (1)multipole_mod.f90:38.26: TYPE(ions_obj) :: ions 1Error: Unexpected data declaration statement in CONTAINS section at (1)multipole_mod.f90:40.38: CALL SYSTEM_CLOCK(t1,cr,count_max) 1Error: Unexpected CALL statement in CONTAINS section at (1)multipole_mod.f90:42.52: WRITE(*,'(/,2x,A)') 'CALCULATING DIPOLE MOMENTS' 1Error: Unexpected WRITE statement in CONTAINS section at (1)multipole_mod.f90:43.63: WRITE(*,'(2x,A)') ' 0 10 25 50 75 100' 1Error: Unexpected WRITE statement in CONTAINS section at (1)multipole_mod.f90:44.43: WRITE(*,'(2x,A,$)') 'PERCENT DONE: **' 1Error: Unexpected WRITE statement in CONTAINS section at (1)multipole_mod.f90:46.19: ALLOCATE(dipole(ndim,3)) 1Error: Syntax error in ALLOCATE statement at (1)multipole_mod.f90:47.12: dipole=0 1Error: Unexpected assignment statement in CONTAINS section at (1)multipole_mod.f90:48.16: shift=0.5_q2 1Error: Unexpected assignment statement in CONTAINS section at (1)multipole_mod.f90:49.26: IF (vasp) shift=1.