Join 2 FORTRAN Codes: Problem Solved w/ Intel Compiler & Linux

  • Context: Fortran 
  • Thread starter Thread starter Milentije
  • Start date Start date
  • Tags Tags
    Fortran Subroutine
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
3 replies · 6K views
Milentije
Messages
47
Reaction score
0
I have a problem,actually I want to join two FORTRAN codes.One of them is main and the other calculates some issues(geophysics stuff).I am not sure that the second code can be represented as subroutine because it has 2000+ lines,with 10 subroutines inside itself.How to solve this?Is it possible that one executable calls the other?I am working on Linux,with Intel Fortran compiler.
 
Physics news on Phys.org
I need interface between two programs.I can not put second program as module cause I get errors like this:
mt2ddib1.for(23): error #6274: This statement must not appear in the specification part of a module
open(2,file='test_p7.dat',status='old')
--------^
mt2ddib1.for(29): error #6274: This statement must not appear in the specification part of a module
open(3,file='test_sh7.dat',status='old')
--------^
mt2ddib1.for(30): error #6274: This statement must not appear in the specification part of a module
open(4,file='test_res.dat',status='old')
--------^
mt2ddib1.for(35): error #6274: This statement must not appear in the specification part of a module
open(50,file='e.dat',status='unknown')
 
The four OPEN statements are in the wrong places. Apparently mt2ddib1.for has some variable declarations somewhere after line 35. The declarations need to be moved so that they are above any executable statements (such as your OPEN statements).
 
If you have the source code for the second program, you can either merge it into the first program and make one composite source file, or you can adapt the routines of the second program so that they can be compiled and collected into a code library which is callable by the first program.