s-news
[Top] [All Lists]

Again: Question about calling Fortran code with "stop"

To: s-news@lists.biostat.wustl.edu
Subject: Again: Question about calling Fortran code with "stop"
From: Zhu Wang <zhuw@mail.smu.edu>
Date: Wed, 21 Jul 2004 16:24:34 +0000
Cc: zhuw@mail.smu.edu
In-reply-to: <3A822319EB35174CA3714066D590DCD504AF80AE@usrymx25.merck.com>
References: <3A822319EB35174CA3714066D590DCD504AF80AE@usrymx25.merck.com>
Dear all,

Let me first repeat my previous question and the solution, then post my
follow-up question. 

My previous question was:

> I am writing an S-Plus (version 6.1) function on Windows to call a
> Fortran code. The Fortran code has something like below:
> 
> if(aaa)then
> stop
> 
> The compiled S-Plus function works fine except that whenever aaa is
> TRUE, The Fortran subroutine exits AND the S-Plus session is shutdown
> and I have to restart S-Plus. I just do not like this.
> 
> My question is how should I change the Fortran code or S-Plus 
> code such
> that the Fortran subroutine exits but my S-Plus session is 
> still alive.

A quick solution was 

 if(aaa)then
 return

I found maybe I did not post all related original lines, as follows.

 if(aaa)then
 stop
 end if
 call nextroutine

So the lines become, after replacing "stop" with "return":

 if(aaa)then
 return 
 end if
 call nextroutine

Now here is what I found: I believe the program did not exit. In fact it
still ran "nextroutine" and gave me the results, which I did not expect
to have.

Thanks for any advice.

-- 
Zhu Wang

Statistical Science Department
Southern Methodist University
Dallas, TX 75275-0332



<Prev in Thread] Current Thread [Next in Thread>