Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Waiting for a process completion

Status
Not open for further replies.

cooln

Mechanical
Jul 20, 2007
4
So I am writing a fotran90 code in which I run an executable using system calls:

call system('./myexec')

The executable program writes the data into output file opdata.dat which fortran reads:

read(unit=1,file='opdata.dat',status='old')
!
! Read output data from file
!
close(1)


However, the trouble is the executble takes a long time to complete the process. In the meantime, the read statement tries to access the non-existent file opdata.dat, and obviously return with error. So how do I pasue execution of my fortran code till the process is complete?

One way I can do this is to inquire whether file opdata.dat exists:
inquire(file='opdata.dat',exist=lexist)

and proceed further only when the file exists.

Is there any other elegant way to achive this ?

Thanks!
 
Replies continue below

Recommended for you

Which OS/compiler are you using. Every vendor's version will exhibit different behaviour.
 
So, why can't you use the same process to invoke your and reverse the calling? I.e., program 2 completes, then calls program 1.

TTFN

FAQ731-376
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor