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

Home » Public Forums » archive » 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 #19871 is a reply to message #19741] Mon, 17 April 2000 00:00 Go to previous messageGo to previous message
mallors is currently offline  mallors
Messages: 76
Registered: November 1997
Member
In article <on66tglhxl.fsf@cow.physics.wisc.edu>,
Craig Markwardt <craigmnet@cow.physics.wisc.edu> writes:
>
> I totally agree that the error condition must be handled. What I was
> getting at is that OPENR, ..., /GET_LUN does two things: allocate a
> LUN, and open a file. If you get an ERROR condition back, it's
> impossible to know which of these two things failed. In fact in the
> above example you gave, the unit FL may be undefined, so FREE_LUN will
> fail.

You can tell which of these things failed based on the
name of the error that is returned in the !ERROR_STATE
structure. The documentation states that although the
error code number (a negative integer) can change across IDL
sessions, the error name cannot.

;== The program TEST.PRO tries to open many files,
;== each with a different unit number, and stops
;== if there is an error

IDL> .RUN TEST
% Stop encountered: $MAIN$
IDL> PRINT, error
-234
IDL> HELP, !ERROR_STATE.NAME
<Expression> STRING = 'IDL_M_FILE_NOLUNLEFT'
IDL> PRINT, !ERROR_STATE.MSG
OPENW: All available logical units are currently in use.
IDL>
IDL> CLOSE, /ALL
IDL>
IDL> OPENR, fl, 'nofile', /GET_LUN, ERROR = error
IDL> PRINT, error
-222
IDL> PRINT, !ERROR_STATE.NAME
<Expression> STRING = 'IDL_M_CNTOPNFIL'
IDL> PRINT, !ERROR_STATE.MSG
OPENR: Error opening file. Unit: 100, File: nofile


Regards,

-bob

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~
Robert S. Mallozzi 256-544-0887
Mail Code SD 50
http://gammaray.msfc.nasa.gov/ Marshall Space Flight Center
http://cspar.uah.edu/~mallozzir/ Huntsville, AL 35812
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: how to read GRIB format data (NCEP monthly U/VFlux data)
Next Topic: Theater Arts 101: Intro to Lighting Design

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

Current Time: Thu Oct 09 21:11:26 PDT 2025

Total time taken to generate the page: 0.87784 seconds