Previous IDL Reference Guide: Dot Commands Next


The .RUN command compiles procedures, functions, and/or main programs in memory. Main programs are executed immediately. The command can be followed by a list of files to be compiled. Filenames are separated by blanks, tabs, or commas.

If a file specification is included in the command, IDL searches for the file first in the current directory, then in the directories specified by the system variable !PATH. See Creating $MAIN$ Programs for more information on IDL's search strategy.

If a main program unit is encountered, execution of the program will begin after all files have been read if there were no errors. The values of all of the variables are retained. If the file isn't found, input is accepted from the keyboard until a complete program unit is entered.

Files containing IDL procedures, programs, and functions are assumed to have the file extension (suffix) .pro. Files created with the SAVE procedure are assumed to have the extension .sav. See Creating and Running Programs in IDL for further information.

.RUN is an executive command. Executive commands can only be used at the IDL command prompt, not in programs.


.RUN [File1, ..., Filen]

To save listing in a file:

.RUN -L ListFile.lis File1 [, File2, ..., Filen]

To display listing on screen:

.RUN -T File1 [, File2, ..., Filen]

Subsequent calls to .RUN compile the procedure again.

Using .RUN to Make Program Listings

The command arguments -T for terminal listing or -L filename for listing to a named file can appear after the command name and before the program filenames to produce a numbered program listing directed to the terminal or to a file.

For instance, to see a listing on the screen as a result of compiling a procedure contained in a file named, use the following command:

.RUN -T analyze  

To compile the same procedure and save the listing in a file named analyze.lis, use the following command:

.RUN -L analyze.lis analyze  

In listings produced by IDL, the line number of each statement is printed at the left margin. This number is the same as that printed in IDL error statements, simplifying location of the statement causing the error.

If the compiled file contains more than one procedure or function, line numbering is reset to "1" each time the end of a program segment is detected.

Each level of block nesting is indented four spaces to the right of the preceding block level to improve the legibility of the program's structure.

See Also


  IDL Online Help (March 06, 2007)