Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CALL SYSTEM in Fortran

Status
Not open for further replies.

jpblasques

Marine/Ocean
Nov 24, 2006
20
0
0
DK
Hi everyone!

I am trying to call a program from Fortran using the CALL SYSTEM subroutine. The problem has a little twist to it which is I am trying to run two commands in parallel. I am working on a UNIX machine.

What I have now is:

progam main
.
.
.
CALL SYSTEM('run_prog1 & run_prog2')
.
.
.
end main

What happens is that prog1 and prog 2 are executed (almost) simultaneously (the procedure is rather straight forward as I am simply using "&" to execute the two programs as I would otherwise do in the command prompt). The problem is that the computation of prog1 is different from prog2. So if prog1 is faster than prog2 fortran will finish executing prog1 and proceed reading the next commands from the main program while prog2 keeps running. Well, this is not really what i wanted! I would like Fortran to "wait" for both prog1 and prog2 to be finished (that means they have written their output files) before continuing with the main program.

I am very grateful for any help or any suggestions that you might have.

Regards
José
 
Replies continue below

Recommended for you

Can you have program 1 call program 2, and then not allow program 1 to terminate until after program 2 has terminated?

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Status
Not open for further replies.
Back
Top