Hi Andrew,<br>Yes there is. Here's one way that works for me, in a situation where I search for an available dataset source until I find one (just the applicable part of script shown). The CheckFile function shown will also handle a situation where one file was opened successfully, but you also want to check a second file needed for the operation<br>
:<br> datfile.1='<a href="http://source1.">http://source1.</a>...'<br> datfile.2='<a href="http://source2.">http://source2.</a>...'<br> datfile.3='<a href="http://source3.">http://source3.</a>...'<br>
n=1<br> while(n<=3);#search for a valid file, exit loop when found<br> 'sdfopen 'datfile.n<br> validfile=CheckFile(1);#assumes no previous files open, else use appropriate number<br> if(validfile)<br>
say 'Using 'datfile.n;break<br> else<br> say datfile.n' not available'<br> n=n+1<br> endif<br> endwhile<br> if(validfile)<br> say 'Continuing operation...'<br> else<br> say 'Aborting operation!'<br>
exit<br> endif<br># if validfile=1, then continue operation....<br><br>function CheckFile(filenum)<br>#returns 1=true if data file is valid/open, else 0=false<br> 'q file 'filenum<br> info=sublin(result,1)<br>
if(filenum=1);qa=substr(info,1,13);endif<br> if(filenum=2);qa=substr(info,1,16);endif<br> if(qa='No Files Open'|qa='QUERY FILE Error')<br> return 0<br> else<br> return 1<br> endif<br>return<br>
<br>Perhaps code similar to above will work for you. Good luck.<br>Stephen McMillan<br><br><div class="gmail_quote">On Sat, Nov 13, 2010 at 3:38 AM, Andrew Revering <span dir="ltr"><<a href="mailto:andy@f5data.com">andy@f5data.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div link="blue" vlink="purple" lang="EN-US">
<div>
<p class="MsoNormal">Is there a way to handle errors in grads scripts?</p>
<p class="MsoNormal">For example… I'm opening files in the scripts…
If a file does not exist, I'd like it to realize that and skip it and continue
on.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Andrew Revering</p>
<p class="MsoNormal">Convective Development, Inc.</p>
<p class="MsoNormal"><a href="http://www.convectivedevelopment.com/" target="_blank">http://www.convectivedevelopment.com/</a></p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"> </p>
</div>
</div>
<br>_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
<br></blockquote></div><br>
<pre>***************************************************
The information contained in this e-mail message
is intended only for the use of the recipient(s)
named above and may contain information that is
privileged, confidential, and/or proprietary.
If you are not the intended recipient, you may not
review, copy or distribute this message. If you have
received this communication in error, please notify
the sender immediately by e-mail, and delete the original message.
***************************************************