views:

21

answers:

1

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)

not sure what the error means.

A: 

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.

kemiisto