Fortran Syntax Error In Data Declaration
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies unexpected data declaration statement at (1) of this site About Us Learn more about Stack Overflow the company unterminated character constant Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges
Syntax Error In Argument List Fortran
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:
Fortran Unterminated Character Constant
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 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 fortran line continuation (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 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 alloc
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 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 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) http://stackoverflow.com/questions/13354510/fortran-error-meanings 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 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 http://stackoverflow.com/questions/29355067/syntax-error-in-data-statement 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 INTEGER IV, IY INTEGER NTAB,IDEPTH INTEGER PROD PARAMETER (NTAB=1,IDEPTH=1) PARAMETER (PROD=NTAB*IDEPTH) DIMENSION IV(NTAB,IDEPTH) DIMENSION IY(IDEPTH) DATA IV,IY /PROD*0,IDEPTH*0/ END share|improve this answer edited Mar 30 '15 at 20:48 answered Mar 30 '15 at 20:08 Alexander Vogt 13.1k122448 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and Password Post as a guest Name Email Post as a guest Name Email discard By posting your answer, you agree to the privacy policy and ter
HCL Search Reviews Search ISOs Go to Page... LinuxQuestions.org > Forums > Non-*NIX Forums > Programming gfortran: Syntax error in http://www.linuxquestions.org/questions/programming-9/gfortran-syntax-error-in-data-statement-at-1-a-762221/ DATA statement at (1) User Name Remember Me? Password Programming This https://www.physicsforums.com/threads/gfortran-compiling-error.600539/ forum is for all programming questions. The 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 you syntax error 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 members see fewer ads, and ContentLink is completely disabled once you log in. Are you new to LinuxQuestions.org? Visit the following syntax error in 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 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 Complet
Community Forums > Other Sciences > Programming and Computer Science > Dismiss Notice Join Physics Forums Today! The friendliest, high quality science and math community on the planet! Everyone who loves science is here! Gfortran Compiling Error Apr 26, 2012 #1 RissaR I'm new to programming in Fortran, but have programmed for quite a while in C, Matlab, and Python. This is my code. It's incomplete at the moment (the subroutines are unreferenced), though it should still compile, but won't. Code (Text): PROGRAM bunkers IMPLICIT NONE SUBROUTINE lininterp(ulist,vlist,hlist,targetlvl,u,v) IMPLICIT NONE !Dummy argument declarations REAL, INTENT(IN) :: ulist,vlist,hlist,targetlvl REAL, INTENT(OUT) :: u,v !Local variable declaration REAL :: spacing spacing = hlist(2) - hlist(1) DO i=1,SIZE(hlist) IF (targetlvl>hlist(i) .and. targetlvl < hlist(i+1)): u=(ulist(i+1)-ulist(i))/spacing*(targetlvl-hlist(i))+ulist(i) v=(vlist(i+1)-vlist(i))/spacing*(targetlvl-hlist(i))+vlist(i) END IF END DO RETURN END SUBROUTINE lininterp SUBROUTINE meanwind(ulist,vlist,hlist,blayer,tlayer,meanwind) IMPLICIT NONE !Dummy argument declarations REAL, INTENT(IN) :: ulist,vlist,hlist,blayer,tlayer REAL, INTENT(OUT) :: meanwind !Local variable declaration REAL :: vmod, i, j, umodmean, vmodmean REAL, ALLOCATABLE, DIMENSION(:) :: tailvect,headvect REAL, DIMENSION(2) :: vector,modheadvect,vect,modmean, meanwind REAL, DIMENSION (2,2) :: rotation,counter !Find head and tail wind vectors DO i=1,SIZE(hlist) IF (hlist(i) .eq. blayer) THEN ALLOCATE(tailvect(2)) tailvect = (/ ulist(i),vlist(i) /) ELSE IF (hlist(i) .eq. tlayer) THEN ALLOCATE(headvect(2)) headvect = (/ ulist(i), vlist(i) /) ELSE IF (hlist(i) >= tlayer) THEN EXIT ELSE EXIT END IF END DO IF (.not. allocated(tailvect)) CALL lininterp(ulist,vlist,hlist,blayer,u,v) tailvect = (/ u,v /) END IF IF (.not. allocated(headvect)) CALL lininterp(ulist,vlist,hlist,tlayer,u,v) headvect = (/ u,v