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

AI Thread Summary
To integrate two FORTRAN codes, one being the main program and the other a geophysics calculation tool, it is essential to address the structure of the second code, which contains over 2000 lines and multiple subroutines. Directly incorporating the second code as a module is problematic due to errors related to the placement of executable statements, specifically the OPEN statements, which must be positioned above any executable code in the module. To resolve this, the second program can either be merged into the main program to create a single source file or modified to compile into a code library that the main program can call. This approach allows for an effective interface between the two programs while adhering to FORTRAN's structural requirements.
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.
 
Technology 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.
 
Thread 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.

Similar threads

Replies
3
Views
2K
Replies
59
Views
11K
Replies
8
Views
4K
Replies
4
Views
2K
Replies
5
Views
3K
Replies
2
Views
2K
Back
Top