fortranfortran77

Is it necessary to place an ampersand on the 73rd column for line continuations in Fortran 77?


Consider the following code which has a long string variable:

      CHARACTER*256 MYSTRING
      DATA MYSTRING / 'Lorem ipsum dolor sit amet, consectetur adipiscin&
     &g elit, sed do eiusmod tempor incididunt ut labore et dolore magna&
     & aliqua.' /
      PRINT *, MYSTRING

In column 73 of lines 2 and 3, there is an ampersand. Are the ampersands necessary, or can they be removed? I understand that the beginning & on column 6 is important for line continuations, but I do not know whether or not the trailing & on column 73 has any significance.


Solution

  • No, it is not necessary in fixed source form (not just Fortran 77). Characters in columns 73 and further are ignored.

    But the ampersand are useful when the same source file is compiled as free source form, for example as an include file that is compatible with both forms ("intersection form").