2
votes

I'm compiling an old .for file (Fortran 77) in gfortran for the first time and getting errors that I never saw previously (with another compiler that I no longer have access to). The errors are as follows:

smog5.for:159:32:

98   format (1x,f4.1,5x,14(1x,pe9.3))

1 Error: P descriptor requires leading scale factor in format string at (1) smog5.for:161:35:

96   format (/'Emissions:',10(1x,pe9.3))

1 Error: P descriptor requires leading scale factor in format string at (1) smog5.for:141:20:

      write (1,98) etime,(c(i),i=1,10),o,oh,rk(1),rk(6)

1 Error: FORMAT label 98 at (1) not defined smog5.for:153:21:

       write (1,96) (E(i),i=1,10)

1 Error: FORMAT label 96 at (1) not defined

The troublesome bits of code (within a much larger program) seem to be:

  goto 10  

 98   format (1x,f4.1,5x,14(1x,pe9.3))
 97   format (/'end day',i2/)
 96   format (/'Emissions:',10(1x,pe9.3))

  end


  subroutine hybrid(n,c,rk,tin,tout,E,dep,vent,etime,o,oh,m,o2)

Can someone help me figure out what's wrong with the syntax here? Or is this something that would be solved with another compiler? I unfortunately don't have access to the previous compiler that worked, as it was on a secured server at a former school. I've translated the program to .f90 but get the same P descriptor errors.

1

1 Answers

3
votes

The P format specifier requires a digit in front, e.g., 1pe9.3. The P specifier behaves differently on input and output. It's convenient for output but rather strange for input -- consult documentation.

The error messages about the format labels not being defined are a consequence of the error with the format string (P descriptor) and should be solved when you fix that.