Getting this error while trying to compile a copied code from a Fortran 77 program.
code:
900 FORMAT(1H0,2X,'ABSOLUTE GRID LIMITS FOR DATA RETENTION FOR RADAR',I3,' XMIN-XMAX ',2F8.3,' YMIN-YMAX ',2F8.3,' ZMAX ',F8.3, /3X,'WITH AZIMUTH LIMITS OF',2F8.2, 3X,'AND RANGE LIMITS OF',2F10.3,/)
compiler error:
messy21.f90:529.132:
N FOR RADAR',I3,' XMIN-XMAX ',2F8.3,' YMIN-YMAX ',2F8.3,' ZMAX ',F8.3, /3X,(1)
Error: Unexpected end of format string in format string at (1)
I am not sure what the error means.
My guess (on the basis of error position in the line, 132) would be: starting from Fortran 90 we use free source form (free-form source input). Each line may contain up to 132 character. And if your statement is even bigger you can use up to 39 (255 in current Fortran 2003 standard) continuation lines. Fortran 77 used fixed source form which is just another story.
Use so-called continuation mark (&) to divide your very long FORMAT statement, i.e.
900 FORMAT(1H0,2X,'ABSOLUTE GRID LIMITS FOR DATA RETENTION FOR RADAR',I3,' XMIN-XMAX ',2F8.3,' YMIN-YMAX ',2F8.3,' ZMAX ',F8.3, &
/3X,'WITH AZIMUTH LIMITS OF',2F8.2, 3X,'AND RANGE LIMITS OF',2F10.3,/)
Read some Fortran 90/95/2003 book or associated section of Fortran standard. For example, in Fortran 2003 Standard (Final Committee Draft, PDF, 5MB) section "3.3 Source form" contains relevant information.
Your line is too long.
In free form files (.f90) you can only use 132 character lines. You can break your line and continue on the next line. Put &
character
at the end of the line before continuing on the next line.
In fixed form Fortran (.f .for) you can only use 72 character lines. You can break your line and continue on the next line. Put any character to the fifth column on the present line.
There are compiler options which can loosen these restrictions.