comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: openr and /get_lun
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: openr and /get_lun [message #19733] Mon, 17 April 2000 00:00 Go to previous message
Nando Iavarone is currently offline  Nando Iavarone
Messages: 48
Registered: December 1998
Member
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Craig Markwardt wrote:
<blockquote TYPE=CITE>I have noticed that the use of /GET_LUN and ERROR
keywords to openr is
<br>not as helpful as I would have hoped.&nbsp; Do other have this experience?
<br>The problem is that when an error occurs, it is hard to know whether
<br>the file unit was "gotten" or not.
<p>For example:
<p>pro test1
<br>&nbsp; openr, unit, filename, /get_lun, error=err
<br>&nbsp; free_lun, unit
<br>end
<p>If there was an error, then it is possible that UNIT was never set,
<br>and is hence undefined.&nbsp; FREE_LUN doesn't take undefined variables.
<p>If there is error checking to do, I don't know exactly what it should
<br>be.&nbsp; So I find myself explicitly doing this instead:
<p>pro test2
<br>&nbsp; get_lun, unit
<br>&nbsp; openr, unit, filename, error=err
<br>&nbsp; free_lun, unit
<br>end
<p>Comments?
<br>&nbsp;</blockquote>
Hi Craig,
<br>you have to trap the error.
<br>it is the open that can fail, so you have to check the err variable:
<p>pro test2
<br>&nbsp; get_lun, unit
<br>&nbsp; openr, unit, filename, error=err
<br>&nbsp; if (err le 0) then begin
<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; ;error management
<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; ...............................
<br>&nbsp; endif
<br>&nbsp; free_lun, unit
<br>end
<br>&nbsp;
<br>&nbsp;
<pre>You can also use the more flexible error trapping CATCH procedure.</pre>

<pre>It is general and not only for file management:</pre>

<pre></pre>
pro testOpen<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; errorStatus=0<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; catch,errorStatus<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; if errorStatus ne 0 then begin
<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
;error management<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
print,!ERR_STRING<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
return<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; endif<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; openr,lun,'pippone',/get_lun<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; free_lun,lun<br>
end
<br>&nbsp;
<pre>--&nbsp;
Nando Iavarone
Advanced Computer System - SPACE DIVISION
via Lazzaro Belli, 23
00040&nbsp; Frascati - RM
Tel: +39-6-944091 (switchboard)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 9440968 (direct)
E-mail:&nbsp;
&nbsp;&nbsp;&nbsp; f.iavarone@acsys.it
&nbsp;&nbsp;&nbsp; FrdndVrn@altavista.net</pre>
&nbsp;</html>
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: interactive plotting and ps output.
Next Topic: ROUTINE_NAMES and other magic

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sun Oct 12 08:00:20 PDT 2025

Total time taken to generate the page: 1.19821 seconds