Q:

interface for fortran 77 in 95 program

I am quite new to fortran, and only write in fortran 95 and 2003. Now I have a program that is mainly written in 95, but it is completely in fortran 77 syntax and also contains some 77 functins.
Now I need the functionality in another program, but don't want to rewrite the whole program. My idea was to replace 
program my_prog

with
module my_mod
subroutine my_prog()

The replacement does not seem to work. The compiler states, that the syntax from
subroutine my_prog()

is wrong. Does anyone have some experiance with the topic, or knows if it is even possible to implement the code without rewriting it?

A:

The correct syntax for a module subroutine sub is
module name_of_the_module

  use whatever

  implicit none

  !some variables and interfaces

  contains

    subroutine sub
      !here is the code of your subroutine
    end subroutine sub

end module name_of_the_module

Otherwise, it should be noted, that you can call the code in FORTRAN 77 from a newer code. It is (with some exceptions) still a valid Fortran 2008 code, just in an old style. The only exception is you cannot mix free and fixed source format in one source file. That may also be your problem.
The best thing to do is to make the old functions and subroutines to conform also to the free source format (see "intersection format" here) and place them into a module as I showed above.

