Categories | Alphabetical | Classes | All Contents | [ < ] | [ > ]

SAVE


Syntax | Arguments | Keywords | Examples | Version History | See Also

The SAVE procedure saves variables, system variables, and IDL routines in a .sav 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.

Note
When using the SAVE procedure, some users identify binary files containing variable data using a .dat extension instead of a .sav extension. While any extension can be used to identify files created with SAVE, it is recommended that you use the .sav extension to easily identify files that can be restored.

Syntax

SAVE [, Var1, ..., Varn] [, /ALL] [, /COMM, /VARIABLES] [, /COMPRESS] [, FILENAME=string] [, /ROUTINES] [, /SYSTEM_VARIABLES] [, /VERBOSE]

Arguments

Varn

One or more strings containing the names of variables, routine definitions, or common blocks that are to be saved. If no Var arguments are provided, all variables, routine definitions, or common blocks are saved.

Keywords

ALL

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

Note
Routines and variables cannot be saved in the same file. Setting the ALL keyword does not save routines.

COMM

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.

COMPRESS

If COMPRESS is set, IDL writes all data to the SAVE file using the ZLIB compression library to reduce its size. IDL's save file compression support is based on the freely available ZLIB library by Mark Adler and Jean-loup Gailly.

Compressed .sav files can be restored by the RESTORE procedure in exactly the same manner as any other .sav file. The only visible differences are that the files will be smaller, and writing and reading them will be somewhat slower under typical conditions.

FILENAME

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. It is recommended that the extension, .sav, be specified for any file created with the SAVE procedure.

ROUTINES

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. Routines and variables cannot be saved in the same file.

Warning
.sav files containing routines are not guaranteed to be compatible between successive versions of IDL. You will not be able to RESTORE .sav files containing routines if they are made with incompatible versions of IDL. In this case, you should recompile your original code with the newer version of IDL. A .sav file containing data will always be restorable.

SYSTEM_VARIABLES

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

Warning
Saving system variables is not recommended, as the structure may change between versions of IDL.

VARIABLES

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

VERBOSE

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

Examples

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

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

The variables can be restored with the RESTORE procedure.

Save the user procedures MYPROC and MYFUN:

SAVE, /ROUTINES, 'MYPROC', 'MYFUN', FILENAME = 'myroutines.sav' 

Version History

Introduced: Original

See Also

JOURNAL, RESOLVE_ALL, RESTORE


Categories | Alphabetical | Classes | All Contents | [ < ] | [ > ]