Syntax error when compiling
Not sure if this is the place to be asking, but I've got a FORTRAN issue that is driving me crazy.
I've added an OPEN/READ statement to a preexisting energy balance model because i need to run the code with changing atmospheric variables: Code:
Code:
fortcom: Error: atmos.F, line 72: Syntax error, found INTEGER_CONSTANT '550' when expecting one of: <LABEL> <END-OF-STATEMENT> ; BLOCK BLOCKDATA PROGRAM TYPE COMPLEX BYTE CHARACTER ... ->If I move the format line to the left, then the same error pops up, but the 550 is replaces with a "*". ->If I move the rest of it to the left I get a bunch of problems related to the 'j=1,nlat' part. ->If I change the order of the PRINT and format statements, same errors, no change. ->If I move the block to the right no change in the errors occurs (expectedly). Unfortunately, the code's *enormous*, so numbering the lines would be a bitch. Anyone have any ideas? |
Here we go
Quote:
but see http://www.cs.mtu.edu/~shene/COURSES...05/format.html for different and allegedly better solution |
aah, but when I move the FORMAT line to the left I get this:
Code:
echo '** Compiling atmos.F' |
Quote:
1. Write a one-line program. Compile it. 2. Did it compile and run? If not, go back to step 1. If it did, go to step 3. 3. Add ONE LINE to your computer program and recompile it. Did it compile and run? If so, repeat. If not, go back to step 1. In fact, here's your first Fortran program, gratis: Code:
program hello Choose a manageable programming task. Complete it successfully. Then choose a more challenging programming task, but in small increments that you both understand and control. That way, rather than relying on experts, you become an expert. |
I'm not writing this, I'm altering a preexisting program to do something else....
I've fixed many of the problems already, this last one I'm having trouble with. |
Quote:
I say this because you know what the program must do and you intend to test its ability to do that, meaning you won't be accepting anything on blind faith. Given that premise, you might be better off writing the program in a modern language, one that has a future (Fortran only has a past) as well as having more control over the process and the outcome. I say this because I have been in any number of similar positions during my time at NASA. In modern times, with the wide number of programming choices available, it is even easier to decide to cut one's losses and recreate a program's functions from scratch. |
:) I'm a research assistant for NASA. One of their astrobiology research teams specifically.
I'm using an old energy balance model for Earth (originally written by my advisor's advisor), but have changed it to work for ancient Mars. We need to cover various possible atmospheres - hence the changing input for 'atmos.F'. The ebm is enormous, with a dozen different make files, so starting over from scratch would take months. Everything's awesome (after some debugging), with the exception of this one block I've added to the atmospheric file. Totally frustrating. |
Good luck. Been there. Sometimes these things can be maddening. I've done some scientific programming in C and fortran in the past and these types of bugs make you a better person. ;-) (At least you feel great relief when you figure them out.)
I would recommend carefully reviewing the compile time options and any compiler switches that might affect this module to see if there is anything that might affect this particular syntax. I'm not familiar with PE6... Is that a short-hand number syntax that you have to enable a special compiler switch to recognize? |
I recommend you try my 2nd link, that bypasses the issue.
Another thing I do in any lang for an error I don't get; write a short-as-possible example of the problem code and debug that. Once you've solved it there, you can dd it to the real program. Don't keep messing with the big program. |
All times are GMT -5. The time now is 04:51 PM. |