New Reply

Transfer data between 2 individual program fortran

 
Share Thread Thread Tools
May8-12, 10:40 PM   #1
 

Transfer data between 2 individual program fortran


hi all
i try to transfer data between 2 individual program fortran . I've ever tranferred data between 2 subroutine by using common block, but 2 program make so confused. Have you ever done like me can share some experience ?

thank you
 
PhysOrg.com
PhysOrg
science news on PhysOrg.com

>> Scientist finds topography of Eastern Seaboard muddles ancient sea level changes
>> Stacking 2-D materials produces surprising results
>> Facebook and Twitter jump on Google glasses (Update)
May9-12, 09:27 AM   #2
 
If you are talking about 2 different fortran progarms, each with its own 'main'...it is not possible to share memory between them (that's what common blocks are...memory).

If you have the ability to run one fortran program at one time and the other at other time...you cannot expect them to share memory.

If anything, you can write the data to disk in certain order from one program and read it from the other in the same order when it runs...you can choose text or binary format.
 
May9-12, 09:54 PM   #3
 
Dear gsal

Of course, I know that and I try to change one of two programe to a sub-program and try to transfer data. But when i allocate some variable in it , it occcurs erros ...
 
May10-12, 12:42 AM   #4
 
Mentor

Transfer data between 2 individual program fortran


Quote by luonganh89 View Post
Dear gsal

Of course, I know that and I try to change one of two programe to a sub-program and try to transfer data. But when i allocate some variable in it , it occcurs erros ...
If you want help here, you're going to have to be more specific. "it occcurs erros" doesn't give us any ideas what kinds of problems you are encountering.
 
May10-12, 06:45 AM   #5
 
Yeah, please be clear...

In your original post (and title of this thread) you said you wanted to transfer data between two programs...now you say that you turned on of them into a subroutine...that's not transfering data between two programs!

If you can, "stop the hand waving" and ask very specific questions and, if possible, post the fortran code itself.
 
May10-12, 11:54 AM   #6
 
Recognitions:
Homework Helper Homework Help
I assume there is no way for separate fortran programs to access each others memory via the DuplicateHandle() method available with various versions of Windows with C programs (although generally the one program has to invoke the other program in order to pass some parameters on the command line used to define and share handles required for DuplicateHandle() ).

An option would be to use a file to share data, along with one or more "handshake" files used to synchonize communication. The issue here is how to "wait" for input from the "other" program. If your version of Fortran includes a sleep function, you can reduce the cpu overhead and/or prevent locking up the process. For each handshake file, you only need one integer as a state flag for each data path (from one program to the other or vice versa):

0 = no pending data, set by sending program (and also the initial value)
1 = pending data, set by sending program (which then "waits" for value == 2 or 3)
2 = data read by receiving program, set by receiving program
3 = optional state, set by receiving program to indicate it's ready to for more data.
 
May14-12, 07:16 AM   #7
 
Can you implement networking capability through FORTRAN like TCP/IP?

If you can, then do this.
 
New Reply
Thread Tools


Similar Threads for: Transfer data between 2 individual program fortran
Thread Forum Replies
Fortran Program Won't run Programming & Comp Sci 15
help with fortran program Programming & Comp Sci 6
Fortran: heat transfer program quick help Programming & Comp Sci 3
running a Fortran 77 program in a C++ enviorment/program Programming & Comp Sci 2
Individual Study Program Academic Guidance 6