gccfortrangfortran

What Fortran compiler supports these features?


I've got some legacy code I'm trying to compile, and my available compilers are choking. Here are the lines causing the problems:

line 5:

DIMENSION MMO(12)/31,28,31,30,31,30,31,31,30,31,30,31/

lines 7, 8:

DEFINE FILE 4(ANSI,FB,140,3360,0)
DEFINE FILE 7(SDF, ,42,42)

line 119:

1905 FORMAT(J2,J4,J2,29I5)

Lahey-Fujistu 95 says:

1116-S: "fz32.f", line 5, column 24: Comma expected.
1110-S: "fz32.f", line 5, column 28: Missing name.
1336-S: "fz32.f", line 7, column 7: DEFINE FILE statement not supported.
1336-S: "fz32.f", line 8, column 7: DEFINE FILE statement not supported.
1511-S: "fz32.f", line 119: Invalid character string 'J' found in format specification.
1515-S: "fz32.f", line 119: Edit descriptor must be specified after the repeat specification in a format specification.

...and more missing name errors

gfortran 77 says:

fz32.f:5:
         DIMENSION MMO(12)/31,28,31,30,31,30,31,31,30,31,30,31/
                          ^
Invalid form for DIMENSION statement at (^)
fz32.f:7:
         DEFINE FILE 4(ANSI,FB,140,3360,0)
         1                     2
Unrecognized statement name at (1) and invalid form for assignment or statement-function definition at (2)
fz32.f:8:
         DEFINE FILE 7(SDF, ,42,42)
         1                  2
Unrecognized statement name at (1) and invalid form for assignment or statement-function definition at (2)
fz32.f:119:
    1905 FORMAT(J2,J4,J2,29I5)
                ^
Unrecognized FORMAT specifier at (^)
fz32.f:119:
    1905 FORMAT(J2,J4,J2,29I5)
                   ^
Unrecognized FORMAT specifier at (^)
fz32.f:119:
    1905 FORMAT(J2,J4,J2,29I5)
                      ^
Unrecognized FORMAT specifier at (^)

gcc fails with similar errors.

So does anyone know what compiler could have been used to build this code?

Also, on lines 7 and 8, ANSI and SDF are not defined earlier in the code. How do these lines work? I expect them to be formatting flags, but I don't see that documented anywhere.


Solution

  • This one:

    DIMENSION MMO(12)/31,28,31,30,31,30,31,31,30,31,30,31/

    is just a non-standard version of a data statement. In F77 you could do

      DIMENSION MMO(12)
      DATA MMO /31,28,31,30,31,30,31,31,30,31,30,31/
    

    or in modern fortran you could do

      integer, dimension(12) ::  mmo = [31,28,31,30,31,30,31,31,30,31,30,31 ]
    

    The define stuff is a little more obscure (and probably identifies the compiler as a DEC compiler or related -- oof, that's old). It looks like you're going to want to convert

    DEFINE FILE 4(ANSI,FB,140,3360,0)
    DEFINE FILE 7(SDF, ,42,42)
    

    Into something like

    OPEN(unit=4, access='direct', reclen=FB)
    OPEN(unit=7, access='direct')
    

    and see how that goes.

    The J specifier I can't find anywhere (and googling for J is about as helpful as you'd think). So maybe I'm wrong about DEC. Can you give us an example as to how format 1905 is used?