Routines (alphabetical) > Dot Commands > .RUN

# .RUN

The .RUN command compiles procedures, functions, and/or main programs in memory. Main programs are executed immediately. The command can be optionally followed by a list of files to be compiled. Filenames are separated by blanks, tabs, or commas. If no file name is specified, 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`.

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

## Syntax

.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]

Note: Subsequent calls to .RUN compile the procedure again.

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.

If no file specification is provided, IDL starts a command-line program editor, which allows you to define and compile procedures, functions, or $MAIN$ programs. To use the command-line program editor:

1. Enter `.RUN` at the IDL command line. The command line prompt changes from `IDL>` to `-`.
2. Enter program statements to define your procedure, function, or $MAIN$ program.
3. After you enter the `END` statement, IDL switches back to the normal command line prompt. The procedure or function you defined is now compiled and can be called. If you defined a $MAIN$ program, it is executed immediately.

### 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 `analyze.pro`, 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.

Note: 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

.COMPILE, .RNEW