<div dir="ltr">A &#39;computer-science&#39; person will have to answer. However, the output from the *nix redirect (&#39;standard out&#39;) and the fortran output are likely on different and uncoordinated IO channels.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jul 12, 2017 at 12:47 AM, Barry Lynn <span dir="ltr">&lt;<a href="mailto:barry.h.lynn@gmail.com" target="_blank">barry.h.lynn@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi:<div><br></div><div>I figured out what the problem was.</div><div><br></div><div>It turns out that if you do this (on my computer):</div><div><br></div><div>ncl ./my_program.ncl &gt; dumb.file, one only sees in &quot;dumb.file&quot; the last item written in the call to the subroutine (where I wrote: &quot;return now.&quot;).</div><div><br></div><div>The print statements that I put in the NCL program after the call, indicating that the program has returned, were not included in the redirect.  I could see this when I ran the program without the redirect (and the program terminates later in the NCL script).</div><div><br></div><div>I am not sure why this happens, but it does lead to some confusion.</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>Barry</div></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jul 11, 2017 at 10:21 PM, Barry Lynn <span dir="ltr">&lt;<a href="mailto:barry.h.lynn@gmail.com" target="_blank">barry.h.lynn@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I realize that the background information was a bit vague.  <div><br></div><div>In any case, thank you for confirming what I thought.<div><br></div><div>I was able to verify that the fortran code executed until the &quot;return.&quot;  However, it doesn&#39;t proceed to write a print statement in the NCL script immediately after the call to the WRAPIT fortran program. Hence, my thought that it was <i>not</i> &quot;returning.&quot;</div><div><br></div><div>I will double check the code (perhaps simplify it), since you noted that the code should return.</div><span class="m_1815120181812471295HOEnZb"><font color="#888888"><div><br></div><div>Barry</div></font></span></div></div><div class="m_1815120181812471295HOEnZb"><div class="m_1815120181812471295h5"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jul 11, 2017 at 9:20 PM, Dennis Shea <span dir="ltr">&lt;<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><pre>The question is a bit vague on details.<br><br>Yes, the fortran code &#39;returns&#39; to the NCL calling environment.<br>You can put print statements in the fortran code to see what has executed.<br><br><br>====&gt; fortran file:  quad.f<br></pre><pre>C NCLFORTSTART
      subroutine cquad (a, b, c, nq, x, quad)<br>      implicit none<br>      integer nq              ! input<br>      real a, b, c, x(nq)     ! input<br>      real quad(nq)           ! output; must be pre-allocated in NCL
C NCLEND
C
C  Calculate quadratic polynomial values.
C<br>     </pre><pre>      print *,&quot;Before do loop&quot;    ! DEBUG<br></pre><pre>      do i=1,nq<br>         print *,&quot;Before quad(i); i=&quot;,i<br>         quad(i) = a*x(i)**2 + b*x(i) + c<br>         print *,&quot;After quad(i); quad(i)=&quot;,quad(i)<br>      end do
<br>      print *,&quot;Before return: Done!&quot;    ! DEBUG
      return
      end<br><br>=====<br></pre><pre>%&gt; WRAPIT quad.f<br><br></pre><pre>Creates quad.so<br>====<br></pre><pre>NCL script: example.ncl<br>===<br></pre><pre><br>external QUAD &quot;./quad.so&quot;
 
begin
;
; Calculate three values of a quadratic equation
;
   nump = 3
   x    = (/ -1., 0.0, 1.0 /)
   qval = new(nump,float)                  ; create memory for the &#39;return&#39; values            
   QUAD::cquad(-1., 2., 3., nump, x, qval) ; Call the NCL version of
                                           ; your Fortran subroutine.
   print(&quot;Polynomial value = &quot; + qval)     ; Should be (/0,3,4/)

end<br><br>====<br></pre><pre>%&gt; ncl  example.ncl<br></pre></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="m_1815120181812471295m_5387462770059296130h5">On Tue, Jul 11, 2017 at 9:11 AM, Barry Lynn <span dir="ltr">&lt;<a href="mailto:barry.h.lynn@gmail.com" target="_blank">barry.h.lynn@gmail.com</a>&gt;</span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="m_1815120181812471295m_5387462770059296130h5"><div dir="ltr">Hello:<div><br></div><div>I wrote a fortran program that I can from an ncl program.</div><div><br></div><div>I have a &quot;return&quot; at the end of the fortran program, linked with WRAPIT.</div><div><br></div><div>However, my ncl program does not go beyond the call to the </div><div>WRAPIT fortran program call.</div><div><br></div><div>Am I missing something?  I would expect the ncl program to return</div><div>and continue from there.</div><div><br></div><div>Thank you,</div><div><br></div><div>Barry<br clear="all"><div><br></div>-- <br><div class="m_1815120181812471295m_5387462770059296130m_-3595119192940889298m_-8004365432726582258gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Barry H. Lynn, Ph.D<div><div>Senior Lecturer,</div><div><div><span style="color:rgb(136,136,136)">The Institute of the Earth Science, </span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">The Hebrew University of Jerusalem, </span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Givat Ram, Jerusalem 91904, Israel </span><br style="color:rgb(136,136,136)"></div><span style="color:rgb(136,136,136)">Tel: 972 547 231 170</span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Fax: (972)-25662581</span></div></div><div><span style="color:rgb(136,136,136)"><br></span></div><div>C.E.O, Weather It Is, LTD<br>Weather and Climate Focus<br><a href="http://weather-it-is.com" target="_blank">http://weather-it-is.com</a><br>Jerusalem, Israel<br>Local: 02 930 9525<br>Cell: 054 7 231 170<br>Int-IS: x972 2 930 9525<br>US <a href="tel:(914)%20432-3108" value="+19144323108" target="_blank">914 432 3108</a><br></div></div></div>
</div></div>
<br></div></div>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailma<wbr>n/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="m_1815120181812471295m_5387462770059296130gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Barry H. Lynn, Ph.D<div><div>Senior Lecturer,</div><div><div><span style="color:rgb(136,136,136)">The Institute of the Earth Science, </span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">The Hebrew University of Jerusalem, </span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Givat Ram, Jerusalem 91904, Israel </span><br style="color:rgb(136,136,136)"></div><span style="color:rgb(136,136,136)">Tel: 972 547 231 170</span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Fax: (972)-25662581</span></div></div><div><span style="color:rgb(136,136,136)"><br></span></div><div>C.E.O, Weather It Is, LTD<br>Weather and Climate Focus<br><a href="http://weather-it-is.com" target="_blank">http://weather-it-is.com</a><br>Jerusalem, Israel<br>Local: 02 930 9525<br>Cell: 054 7 231 170<br>Int-IS: x972 2 930 9525<br>US <a href="tel:(914)%20432-3108" value="+19144323108" target="_blank">914 432 3108</a><br></div></div></div>
</div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="m_1815120181812471295gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Barry H. Lynn, Ph.D<div><div>Senior Lecturer,</div><div><div><span style="color:rgb(136,136,136)">The Institute of the Earth Science, </span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">The Hebrew University of Jerusalem, </span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Givat Ram, Jerusalem 91904, Israel </span><br style="color:rgb(136,136,136)"></div><span style="color:rgb(136,136,136)">Tel: 972 547 231 170</span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Fax: (972)-25662581</span></div></div><div><span style="color:rgb(136,136,136)"><br></span></div><div>C.E.O, Weather It Is, LTD<br>Weather and Climate Focus<br><a href="http://weather-it-is.com" target="_blank">http://weather-it-is.com</a><br>Jerusalem, Israel<br>Local: 02 930 9525<br>Cell: 054 7 231 170<br>Int-IS: x972 2 930 9525<br>US <a href="tel:(914)%20432-3108" value="+19144323108" target="_blank">914 432 3108</a><br></div></div></div>
</div>
</div></div></blockquote></div><br></div>