The SAVE procedure saves variables, system variables, and IDL routines in a file using the XDR (eXternal Data Representation) format for later recovery by RESTORE. Note that variables and routines cannot be saved in the same file. Note also that save files containing routines may not be compatible between different versions of IDL, but that files containing data are always backwards-compatible.

Calling Sequence

SAVE [, Var 1 , ..., Var n ]


Var n

Optional named variables that are to be saved.



Set this keyword to save all common blocks, system variables, and local variables from the current IDL session.


Set this keyword to save all main level common block definitions. Note that setting this keyword does not cause the contents of the common block to be saved unless the VARIABLES keyword is also set.


A string containing the name of the file into which the IDL objects should be saved. If this keyword is not specified, the file idlsave.dat is used.


Set this keyword to save user defined procedures and functions in a machine independent, binary form. If parameters are present, they must be strings containing the names of the procedures and/or functions to be saved. If no parameters are present, all compiled routines are saved. If you are using VMS, see the XDR keyword below. Routines and variables cannot be saved in the same file.


Set this keyword to save the current state of all system variables.


Set this keyword to save all variables in the current program unit. This option is the default.


Set this keyword to print an informative message for each saved object.


This keyword is obsolete and will be quietly ignored (there is no need to remove uses of the XDR keyword from existing code). IDL always generates XDR format files, although it will continue to read VAX format SAVE files generated by old versions of VMS IDL.


Save the status of all currently-defined variables in the file variables1.dat by entering:

SAVE, /VARIABLES, FILENAME = 'variables1.dat'

The variables can be restored with the RESTORE procedure. Save the user procedures MYPROC and MYFUN:


See Also