Tutorial > Programming with PV-WAVE > Saving Session Commands and Variables
  

Saving Session Commands and Variables
The SAVE command allows you to save some or all of your PV-WAVE session to a file. The RESTORE command imports a previously saved file into your current PV-WAVE session. You can save all or only some of the commands and variables you use in PV-WAVE. By saving your variables, you are prepared to exit and later restore sessions.
 
note
Creating a new save file causes any existing file with the same name to be lost. Use the Filename keyword with the SAVE procedure to avoid destroying files that you want to keep.
Using the SAVE Procedure
The SAVE procedure saves user-generated variables, system variables, and compiled user-written procedures and functions in a file, using an efficient binary format, for later recovery. Information about option choices you have made, such as colors, fonts, journaling, and so forth, is not saved in the session file; it is saved in the WAVE.INI file.
The variables are saved in special data files, where the default extension is .dat.
The command syntax is:
SAVE, FileName='filename', /Variables
where filename is the name of the file to be saved.
Type the full pathname if you want to save the file to a different directory. If you do not specify a filename, the file is saved as wavesave.dat.
To save your variables to a file called vector.dat, type:
SAVE, FileName='vector.dat', /Variables, /Verbose 
PV-WAVE returns something similar to
% SAVE: Portable (XDR) SAVE/RESTORE file.
% SAVE: Saved variable: VECTOR
The Verbose keyword instructs PV-WAVE to print informative messages about saved objects.
 
note
Take care when using the All keyword with the SAVE command. This keyword causes all elements of the current PV-WAVE session to be output to the file, including memory images of user routines. If you modify one of these user routines and then restore the saved file, the saved image of the user routine is used until you replace the compiled image in memory by re-compiling the routine using the .RUN command.
Using the RESTORE Procedure
The RESTORE procedure restores the objects previously saved in a save file when you entered the SAVE procedure at the WAVE> prompt.
If a filename is not supplied in the call to RESTORE, the filename wavesave.dat is used. In addition, you can use keywords with RESTORE. For a list of the keywords, please refer to the PV‑WAVE Reference.
1. To demonstrate that your session information was saved, first type:
EXIT
The operating system prompt appears.
2. Now restart PV-WAVE.
3. To restore your saved session, type:
RESTORE, 'vector.dat', /Verbose
The session information is restored and PV-WAVE returns:
% RESTORE: Portable (XDR) SAVE/RESTORE file.
% RESTORE: Save file written by yourID@your 
computer and the date
% RESTORE: Restored variable: VECTOR.
4. To see vector, type:
PRINT, vector
PV-WAVE returns:
1   2   3   4   5   6

Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.