<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi, Pablo --&nbsp;<div>I am unable to duplicate this problem. I tried it on my mac and on our 64-bit linux server. I copied your addit.gsf and modified it to create addit2.gsf and they both seem to work fine and return a value to test.gs. Here is my code, plus the text of the GrADS session:&nbsp;</div><div><br></div><div>addit.gsf:&nbsp;</div><div><br></div><div><div>function addit(var1,var2)</div><div>sum=var1+var2</div><div>say 'addit: 'var1'+'var2'='sum</div><div>return (sum)</div><div><br></div><div>addit2.gsf<span class="Apple-tab-span" style="white-space:pre">      </span>:</div><div><br></div><div><div>function addit2(args)</div><div>var1=subwrd(args,1)</div><div>var2=subwrd(args,2)</div><div>sum=var1+var2</div><div>say 'addit2: 'var1'+'var2'='sum</div><div>return (sum)</div><div><br></div><div>test.gs:</div><div><div><br></div><div>rc = gsfallow("on")</div><div>tx=addit(2,3)</div><div>say 'addit returned 'tx</div><div><br></div><div>args="2 3"</div><div>tx=addit2(args)</div><div>say 'addit2 returned 'tx</div><div><br></div><div><br></div><div><div>&nbsp;# /usr/local/grads/2.0/2.0.a5/grads -lbc test</div><div><br></div><div>Grid Analysis and Display System (GrADS) Version 2.0.a5</div><div>Copyright (c) 1988-2008 by Brian Doty and the&nbsp;</div><div>Institute for Global Environment and Society (IGES)</div><div>GrADS comes with ABSOLUTELY NO WARRANTY</div><div>See file COPYRIGHT for more information</div><div><br></div><div>Config: v2.0.a5 little-endian readline printim grib2 netcdf hdf4-sds geotiff</div><div>Issue 'q config' command for more information.</div><div>GX Package Initialization: Size = 11 8.5&nbsp;</div><div>Running in Batch mode</div><div>addit: 2+3=5</div><div>addit returned 5</div><div>addit2: 2+3=5</div><div>addit2 returned 5</div><div>ga->&nbsp;</div></div></div></div></div><div><br></div><div><br></div><div>--Jennifer</div><div><br></div><div><span class="Apple-style-span" style="font-size: 12px; "><div>--</div><div>Jennifer M. Adams</div><div>IGES/COLA</div><div>4041 Powder Mill Road, Suite 302</div><div>Calverton, MD 20705</div><div><a href="mailto:jma@cola.iges.org">jma@cola.iges.org</a></div><div><br class="khtml-block-placeholder"></div></span></div><div><br><div><div>On Mar 11, 2009, at 1:37 PM, Pablo Romero wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>I'm reposting this question, since I dont know if the listserver rejected it the first time...<br><br>I've never been able to get the following to work: use the 'return(varname)' statement within a .gsf function to return a value.<br><br>I've only been able to accomplish the passing of variables around between scripts by using '_varname' global variables, but this defeats the whole purpose of creating a script function.<br><br>I want to create a .gsf function that can actually return a value that can be directly assigned to a variable in a .gs file.<br><br>example:<br><br>*gsf file, addit.gsf<br><br>function addit(var1,var2)<br>sum=var1+var2<br>return (sum)<br><br>*test gs file, tst.gs<br><br>rc = gsfallow("on")<br>tx=addit(2,3)<br>say '2+3 is 'tx<br><br>however, this doesnt work...<br>it simply prints '2+3 is ', so the gsf function is NOT returning the value of the 'sum' variable...<br><br>Is this by design or am I doing something incorrectly?<br>are global variables the ONLY way to pass variables between script/script function files?<br><br>If this *is* by design, then I would please like to submit a request to COLA to consider fixing this in future versions.<br><br>P.Romero<br>_________________________________________________________________<br>Windows Live™ Contacts: Organize your contact list.<br><a href="http://windowslive.com/connect/post/marcusatmicrosoft.spaces.live.com-Blog-cns!503D1D86EBB2B53C!2285.entry?ocid=TXT_TAGLM_WL_UGC_Contacts_032009">http://windowslive.com/connect/post/marcusatmicrosoft.spaces.live.com-Blog-cns!503D1D86EBB2B53C!2285.entry?ocid=TXT_TAGLM_WL_UGC_Contacts_032009</a><br></div></blockquote></div><div apple-content-edited="true"><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><br class="Apple-interchange-newline"></span></span></div></span> </div><br></div></body></html>