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 #19734 is a reply to message #19733] Sun, 16 April 2000 00:00 Go to previous messageGo to previous message
majewski is currently offline  majewski
Messages: 15
Registered: March 2000
Junior Member
you could always jump over the access of the file with a GOTO...

pro test_lun_free

filename = 'c:\dne.dat'

openr, unit, filename, /get_lun, error=err
IF (err NE 0) then goto, bad_file
;Insert your read statement here
;Insert your read statement here

print, 'the file exists - lun#', strcompress(string(unit),
/remove_all),' set'
free_lun, unit

;Insert the rest of your program here

bad_file:If err ne 0 then print, 'lun not set'

end

- i think this is what you want
leon

On 14 Apr 2000 16:36:04 -0500, Craig Markwardt
<craigmnet@cow.physics.wisc.edu> wrote:

>
> I have noticed that the use of /GET_LUN and ERROR keywords to openr is
> not as helpful as I would have hoped. Do other have this experience?
> The problem is that when an error occurs, it is hard to know whether
> the file unit was "gotten" or not.
>
> For example:
>
> pro test1
> openr, unit, filename, /get_lun, error=err
> free_lun, unit
> end
>
> If there was an error, then it is possible that UNIT was never set,
> and is hence undefined. FREE_LUN doesn't take undefined variables.
>
> If there is error checking to do, I don't know exactly what it should
> be. So I find myself explicitly doing this instead:
>
> pro test2
> get_lun, unit
> openr, unit, filename, error=err
> free_lun, unit
> end
>
> Comments?
>
> Craig
>
> --
> ------------------------------------------------------------ --------------
> Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
> Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
> ------------------------------------------------------------ --------------

-------------------------
Leon Majewski

Remote Sensing & Satellite Research Group
Curtin University of Technology, Perth, Australia

email: majewski@ses.curtin.edu.au
[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: Tue Dec 02 06:29:16 PST 2025

Total time taken to generate the page: 0.48188 seconds