<div dir="ltr"><div>It is likely, you are violating NCL's "scoping" rules which are similar to Pascal.<br><br>Compiled languages (eg: fortran, C, C++,..) use two steps: (1) compiling and (2) linking in the build process. Compiling translates codes into 'machine language' and results in independent object codes. Linking refers to the creation of a single executable file from multiple
object files. Hence, the compiled program knows where assorted object files are located because of the link process. <br><br>NCL is an interpreted language like Matlab, Python. Rather than compiled, the codes (scripts) are interpreted. There is no conversion to machine code. There is no formal 'link' process. Generally, interpreted languages require a library or function be 'loaded' (ie, 'defined') prior to use. This is called the 'scope' of the code. The 'scope' also applies to variables. An example<br><br>
<p style="margin-top:4.32pt;margin-bottom:0pt;margin-left:0in;text-align:left;direction:ltr;word-break:normal"><font><span style="font-family:Calibri;color:black">load
“dummy_1.ncl”<span> </span>; not aware of
constants or codes below</span></font></p><font>
</font><p style="margin-top:4.32pt;margin-bottom:0pt;margin-left:0in;text-align:left;direction:ltr;word-break:normal"><font><span style="font-family:Calibri;color:black">GRAVITY<span> </span>= 9.8</span></font></p><font>
</font><p style="margin-top:4.32pt;margin-bottom:0pt;margin-left:0in;text-align:left;direction:ltr;word-break:normal"><font><span style="font-family:Calibri;color:black">RGAS<span> </span>= 204</span></font></p><font>
</font><p style="margin-top:4.32pt;margin-bottom:0pt;margin-left:0in;text-align:left;direction:ltr;word-break:normal"><font><span style="font-family:Calibri;color:black">load
“dummy_2.ncl”<span> </span>; can use GRAVITY, RGAS & 'dummy_1.ncl'<br></span></font></p><font>
</font><p style="margin-top:4.32pt;margin-bottom:0pt;margin-left:0in;text-align:left;direction:ltr;word-break:normal"><font><span style="font-family:Calibri;color:black">REARTH<span> </span>=<span>
</span>6371.009<span> </span>; km</span></font></p><font>
</font><p style="margin-top:4.32pt;margin-bottom:0pt;margin-left:0in;text-align:left;direction:ltr;word-break:normal"><font><span style="font-family:Calibri;color:black">load
“dummy_3.ncl”<span> </span>; can use GRAVITY,
RGAS, REARTH</span></font></p><p style="margin-top:4.32pt;margin-bottom:0pt;margin-left:0in;text-align:left;word-break:normal"><font><span style="font-family:Calibri;color:black"> ; dummy_1,ncl, dummy_2.ncl<br></span></font></p><font>
</font><p style="margin-top:4.32pt;margin-bottom:0pt;margin-left:0in;text-align:left;direction:ltr;word-break:normal"><font><span style="font-family:Calibri;color:black">begin<span> ; MAIN </span>; can use GRAVITY,
RGAS, REARTH</span></font></p><p style="margin-top:4.32pt;margin-bottom:0pt;margin-left:0in;text-align:left;direction:ltr;word-break:normal"><font><span style="font-family:Calibri;color:black"> </span><span style="font-family:Calibri;color:black">; dummy_1,ncl, dummy_2.ncl, dummy_1.ncl<br></span></font></p><font>
</font><p style="margin-top:4.32pt;margin-bottom:0pt;margin-left:0in;text-align:left;direction:ltr;word-break:normal"><font><span style="font-family:Calibri;color:black"><span> </span>:</span></font></p><font>
</font><p style="margin-top:4.32pt;margin-bottom:0pt;margin-left:0in;text-align:left;direction:ltr;word-break:normal"><font><span style="font-family:Calibri;color:black">end</span></font></p><font>
<br><span style="font-family:Calibri;color:black">load
“dummy_4.ncl”<span> </span></span>; can NOT be 'seen' by any of the above code so it<br></font></div><font> ; can not be used</font><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Nov 28, 2014 at 8:30 AM, franz <span dir="ltr"><<a href="mailto:f.trotta@sincem.unibo.it" target="_blank">f.trotta@sincem.unibo.it</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear Ncl,<br>
I have written a multi file program in NCL,<br>
There is a main script ‘main.ncl’ which is a entry point of the code<br>
in this file I load external scripts (where there are several utility<br>
function/procdure. lets call script1.ncl and script2.ncl )<br>
<br>
I have a problem when in one of this external script (script1.ncl) I<br>
call a procedure<br>
which is defined in an other external script (scrip2.ncl)<br>
<br>
fatal:syntax error: line 196 in file ./script1.ncl before or near \n<br>
<br>
tempe_myOc,saline_myOc,ssh_myOc,glAttr_description)<br>
--------------------------------------------------------------------------------^<br>
<br>
fatal:syntax error: possibly an undefined procedure<br>
<br>
<br>
How can I solve this problem?<br>
<br>
thanks<br>
Francesco T.<br>
_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
</blockquote></div><br></div>