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

Home » Public Forums » archive » Re: GET_LUN running out of LUNs?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: GET_LUN running out of LUNs? [message #31113] Thu, 13 June 2002 04:13
Niel Malan is currently offline  Niel Malan
Messages: 7
Registered: April 2002
Junior Member
On 12 Jun 2002 16:40:52 -0700, you wrote in comp.lang.idl-pvwave:
> I'm having trouble with GET_LUN and OPENW,
> running out of free units, even though I'm very careful
> to close every unit I open. These are units numbered
> from 100 to 128. I don't remember reading that
> IDL treats them differently than numbers below 100.
>
> Here's are three examples.

Your problem is that the counterpart for GET_LUN is FREE_LUN, and not CLOSE

So:

GET_LUN, unit
OPENR, unit, filename
READF, unit, dummy
CLOSE, unit
FREE_LUN, unit.

Or in shorthand:

OPENR, unit, filename, /GET_LUN
READF, unit, dummy
FREE_LUN, unit ; This works because FREE_LUN automaticall closes the file.

IDL-supplied units range from 100 to 128.

CLOSE, /ALL also frees automatically supplied units, which make your second example work.

To quote from the documentation:

"ALL: Set this keyword to close all open file units. In addition, any file units that were allocated via GET_LUN are freed."


There is not really a need to free the unit in a loop.

Instead of

> FOR i=0,30 do BEGIN
> GET_LUN, unit
> print, i, unit
> close, unit
> ENDFOR
> END
>

use
GET_LUN, unit
FOR i=0,30 do BEGIN
print, i, unit
; OPENR, unit, filename
; READF, unit
; CLOSE, unit
ENDFOR
FREE_LUN, unit

Which will give you the same result as you second example. I am presuming that you will write to the file in the loop.

Rember then, getting a unit is different from opening a file:
OPEN - CLOSE, GET_LUN - FREE_LUN

Niel
Re: GET_LUN running out of LUNs? [message #31120 is a reply to message #31113] Wed, 12 June 2002 16:50 Go to previous message
Ken Mankoff is currently offline  Ken Mankoff
Messages: 158
Registered: February 2000
Senior Member
> CLOSE, unit, /PLEASE ?

You should use FREE_LUN.

I think (not sure) that:

CLOSE is used on LUNs below 100. These LUNs are usually hardcoded. ex:
IDL> OPENR, 42, 'foo'
IDL> CLOSE, 42

FREE_LUN is used on LUNs from 100 to 128. These LUNs are dynamically
allocated via the GET_LUN procedure or keyword. ex:
IDL> OPENR, lun, 'foo', /GET
IDL> FREE_LUN, lun
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Active X
Next Topic: OPI function wave_execute fails on VMS

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

Current Time: Fri Oct 10 06:01:18 PDT 2025

Total time taken to generate the page: 0.56183 seconds