IDL

GET_LUN

GET_LUN

The GET_LUN procedure allocates a file unit from a pool of free units. Instead of writing routines to assume the use of certain file units, IDL functions and procedures should use GET_LUN to reserve unit numbers in order to avoid conflicts with other routines. Use FREE_LUN to free the file units when finished.

Examples


Instead of explicitly specifying a file unit number that may already be used, use GET_LUN to obtain a free one and store the result in the variable U by entering:

GET_LUN, U

Now U can be used in opening a file:

OPENR, U, 'file.dat'

Once the data from “file.dat” has been read, the file can be closed and the file unit can be freed with the command:

FREE_LUN, U

Note also that OPENR has a GET_LUN keyword that allows you to simultaneously obtain a free file unit and open a file. The following command performs the same tasks as the first two commands above:

OPENR, U, 'file.dat', /GET_LUN

Syntax


GET_LUN, Unit

Arguments


Unit

The named variable into which GET_LUN should place the file unit number. Unit is converted into a longword integer in the process. The file unit number obtained is in the range 100 to 128.

Keywords


None.

Version History


Original

Introduced

See Also


FREE_LUN, OPENR/OPENU/OPENW, Understanding (LUNs)

Notes


This page has no user notes yet. Be the first one!


This information is not subject to the controls of the International Traffic in Arms Regulations (ITAR) or the Export Administration Regulations (EAR). However, it may be restricted from transfer to various embargoed countries under U.S. laws and regulations.
© 2014 Exelis Visual Information Solutions