![]() |
|
#1
|
|||
|
|||
Fortran problem...Code:
ok in the above code, I'm getting <END OF EXPRESSION> errors and subscript errors... I'm super confused, this code is suposed to compile, but it had a crap load of errors... im using f90 on a open VMS system... here is the rest of the code... Code:
it's really really long, so if you can help, please do : ) Thanks, Justin |
|
#2
|
|||
|
|||
Re: Fortran problem...I don't know about your FORTRAN, but for mine (GNU f95) the old punched-card tradition of ignoring anything after column 71 still holds.
Try breaking up the statements with continuation characters in column 6: Code:
Note that your "END DO" statement started before column 7, and was also flagged as an error (since columns 1-5 of non-comment statements are reserved for statement numbers). Regards, Dave P.S. The error message from f95 was: Code:
Indicating an error at column 72 (Meaning that it had reached the end of the statement, and the next line was not a continuation line, so that's an error.) I'm wondering what your error messages were (the first few anyhow). P.S.S. After further investigation, I found that if I put 6 or more spaces at the beginning of a line (not a tab char, but actual spaces), lines longer than 72 columns seem to be accepted (but that's for my compiler, f95; I don't know how other compilers will act.) Bottom line: pretend you are using punched cards and look in an old 1965 FORTRAN book to see how to format your source code so that it's portable. <=== That's a joke, you know. Daniel D. McKracken, where are you now? Last edited by davekw7x : 24-Oct-2006 at 10:36.
|
|
#3
|
|||
|
|||
Re: Fortran problem...ok i only have one error left...
and its another <END OF STATEMENT> here is the line of code and error: Code:
Justin help me lol |
|
#4
|
|||
|
|||
Re: Fortran problem...Quote:
Did you try breaking it up into shorter lines with continuation statements? Code:
Regards, Dave |
|
#5
|
|||
|
|||
Re: Fortran problem...yes, the '&' doesn't work, it throws errors, and so does the '+'
and I dont understand the use of format() so i dont really know how to modify the output of the print statement if i wanted to shorten the print statement that is catching a <END OF STATEMENT> ERROR.. but if I were to do that, would it still print on the same line? Justin |
|
#6
|
|||
|
|||
Re: Fortran problem...Quote:
I thought this was a course you are taking. What reference material do you have? Have you looked? Rather than just throwing something together and hoping for the best, I respectfully suggest a little study might be in order. I'll tell you a few things that I know. Keep in mind that I learned FORTRAN many years ago, before FORTRAN 95; before FORTRAN 90; before FORTRAN 77. Some of my techniques are not really necessary, but I have never found a compiler that didn't work as long as I made my program statements like the following: A 'C' in column 1 indicates a comment statement If there isn't a 'C' in column 1, then columns 1-5 are reserved for statement numbers. If columns 1-5 are blank, then a character in column 6 indicates that this is a continuation of the previous statement. Note that in FORTRAN (at least in my FORTRAN), spaces are completely irrelevant except in character fields (stuff between quote marks). In the original FORTRAN there were no character fields in quote marks; string literals were called "Hollerith" fields and were of the form 5HHello Where there was always an integer constant, the character 'H', then the number of characters indicated by the constant. The only place where spaces were not ignored was in Hollerith fields. Columns 7-72 are for FORTRAN stuff and columns 73 and beyond are completely ignored by the compiler. (Originally these columns were used for sequencing on the punched card decks --- not part of FORTRAN.) My advice would be to go through any FORTRAN program and if any line extends beyond column 72, then break it up into shorter lines with continuation statements. Now as far as the FORMAT statement Code:
1X means that it's a regular line. In original FORTRAN, column 1 of each line of printed output was not part of the stuff that is going to be printed, it's a "carriage control" character, so a space in the first position of the printed output told the printer that it's a regular line. A '1' in the first position told the line printer to "eject" the current page. Nowadays we might call this a "form feed" or some such thing. There were other special characters for double spacing, no spacing (that's how we got "bold face" type on line printers: print the same line twice, so that the line would look darker), and maybe even a couple more. It is very likely that modern FORTRAN output handlers simply print exactly what you give it (so a 1X would actually print a space in column 1). But traditionalists always put '1X' or some equivalent in column 1 of the output statements. In this program's FORMAT statement number 788, the first thing (after the space in column 1) to be printed is a character field; that's what the 'A' means. So anything that uses this format statement will put some kind of character field first. The 3F8.2 means that there are three fields for "real" variables (that's what FORTRAN calls its floating point data type --- at least it did in the old days). Each field is eight columns wide and prints its number in fixed point format with 2 decimal digits after the decimal point. Note that a print statement that uses this format statement can have any number of floating point number values. If there are fewer than 3, then that number is printed. If there are more variables than there are fields in the FORMAT statement, the FORMAT scanner starts all over again. It goes back to the first field of the FORMAT statement (the character field) and picks up the same sequence of variables all over again. (You can cause different behavior by putting parentheses around the numerical field specifications.) I'll show an example. I use "engineering" notation (e15.7 would print in "scientific" notation with a zero and a decimal fraction and an exponent. 1pe1t.7 prints with a single-digit integer before the decimal point and the exponent). Code:
Note that the longest line goes exactly to column 72 Output Code:
Now change the third print statement to Code:
The output is exactly the same as before, since the compiler ignored columns 73 and beyond (it doesn't know about the *3). Note that this isn't an error, since the compiler stopped scanning at the end of a perfectly valid statement. In the case of GNU f95, if I turn on the warning messages (use f95 -W on the command line), it gives me a warning: Code:
So I can see what is wrong. If your compiler has command-line switches to make it emit warnings, I strongly suggest that you use them. I can break it up into two lines with a continuation statement: Code:
Note that the '+' must be in column 6 for my compiler, as it did in the old days. Code:
Note that I can break the source line anywhere I want to, but I choose to break it in some way that allows me to inspect it alongside my printout so that I can see what the heck is going on and where the heck the output came from. Regards, Dave Last edited by davekw7x : 24-Oct-2006 at 17:28.
|
|
#7
|
|||
|
|||
Re: Fortran problem...Quote:
Did you paste my statements into your program exactly as I showed? (continuation character in column 6) Quote:
Quote:
Making the statement continue onto the next line has nothing to do with the nature of the statement itself. You can use continuation for any FORTRAN statement. |
Recent GIDBlog
US Elections and the ?Voter?s Responsibility? by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Buffer problem with CD-RWriter | KieranC | Computer Software Forum - Windows | 2 | 07-Jan-2006 02:45 |
| Graphic problem in Unreal Tournament 2004 | zerox | Computer Software Forum - Games | 10 | 09-Oct-2005 13:31 |
| Runtime Problem involving "printf" in C Program | supamakia | C Programming Language | 2 | 09-Oct-2005 11:09 |
| a significant problem after installing Xp | mohammad | Computer Software Forum - Windows | 10 | 09-Aug-2005 08:03 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The