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 
Return to the default flat view Create a new topic Submit Reply
Re: GET_LUN running out of LUNs? [message #31113] Thu, 13 June 2002 04:13 Go to previous message
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
[Message index]
 
Read Message
Read Message
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 18:58:18 PDT 2025

Total time taken to generate the page: 1.12212 seconds