Routines (alphabetical) > Routines: F > FREE_LUN

# FREE_LUN

The FREE_LUN procedure deallocates previously-allocated file units. This routine is usually used with file units allocated with GET_LUN, but it will also close any other specified file unit. If the specified file units are open, they are closed prior to the deallocation.

## Examples

See the example for the GET_LUN procedure.

## Syntax

FREE_LUN [, Unit1, ..., Unitn] [, EXIT_STATUS=variable] [, /FORCE]

## Arguments

### Uniti

The IDL file units (logical unit numbers) to deallocate.

## Keywords

### EXIT_STATUS

Set this keyword to a named variable that will contain the exit status reported by a UNIX child process started via the UNIT keyword to SPAWN. This value is the exit value reported by the process by calling EXIT, and is analogous to the value returned by $? under most UNIX shells.

### FORCE

Set this keyword to override the IDL file output buffer and force the file to be closed no matter what errors occur in the process.

IDL buffers file output for performance reasons. If it is not possible to properly flush this data when a file close is requested, an error is normally issued and the file remains open. An example of this might be that your disk does not have room to write the remaining data. This default behavior prevents data from being lost. To override it and force the file to be closed no matter what errors occur in the process, specify FORCE.

## Version History

Original | Introduced

## See Also

CLOSE, GET_LUN, Understanding (LUNs)