Search code examples
visual-studiovisual-studio-2013fortranintel-fortran

Unrecognized token '&' in Fixed Fortran continuation lines


I am editing an old project that uses fixed form Fortran and compiling with IVF compiler. The current issue I have is with continuation lines in a list:

format(//,  10x,'*******************************************',/, &
     10x,'* DIAGONALS OF THE RESIDUAL COV. MATRIX   *',/,  &
     10x,'*******************************************',//,  &
     2x,'MEASUREMENT',7X,'  RESIDUAL COVARIANCE', /)

For some reason, the ampersand is not working for me and I keep getting the error:

unrecognized token '&' skipped

For smaller lines, increasing the fixed form line length and making the two lines one worked but there are instances where the lines are too large for this. The code was written around 15 years ago and in fixed form Fortran but I am unfamiliar with Fortran and how the new compiler and settings affect the code.

Converting to free form causes a series of errors with other formatting and the code does not seem broken so I do not think converting to free form is necessary. I have tried other methods of indenting, such as an ampersand at the end of a line and at the beginning of next, an asterisk, and a slash that other forums suggested using and they produce the error:

error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: <HOLLERITH_CONSTANT> <CHAR_CON_KIND_PARAM> <CHAR_NAM_KIND_PARAM> <CHARACTER_CONSTANT> ) ...

Is there some sort of formatting I am missing or is there any settings I could edit to fix these errors?


Solution

  • In fixed form Fortran, you continue a line with any character in column 6 of the next line, not an & at the end of the 1st line. Try:

          format(//,  10x,'*******************************************',/,
         c  10x,'* DIAGONALS OF THE RESIDUAL COV. MATRIX   *',/,
         c  10x,'*******************************************',//,
         c  2x,'MEASUREMENT',7X,'  RESIDUAL COVARIANCE', /)