User Guide > Getting Started: Windows > Saving and Restoring PV-WAVE Sessions
  

Saving and Restoring PV-WAVE Sessions
You can enter the SAVE and RESTORE commands at the WAVE> prompt. These functions are used to save and later restore the state of user-generated variables, system variables, and compiled procedures and functions.
 
note
If you run PV‑WAVE in a Console window, you will not be prompted to save your session when you close the Console window or when you exit Windows.
This ability to “checkpoint” a session and then recover it later can be very convenient. Save files can be used for many purposes:
*Save files can be used to recover variables that are used from session to session. A startup file can be used to execute the RESTORE command every time PV‑WAVE is started. See the discussion of startup files in Modifying Your Environment in the PV‑WAVE Programmer’s Guide.
*The state of a PV‑WAVE session can be saved, then quickly restored to the same point, allowing you to stop working, and then later resume at a convenient time.
*Saved files relieve you of the need to remember the dimensions of arrays and other details. It is very convenient to store images this way. For example, if the three variables R, G, and B hold the color table vectors, and the variable Image holds the image data, the PV‑WAVE statement:
SAVE, Filename='image.dat', R, G, B, Image
saves everything required to display the image properly in a file named image.dat. At a later time, the command:
RESTORE, 'image.dat'
will restore the four variables from the file.
*Long iterative jobs can save partial results in save/restore format to guard against losing data if some unexpected event such as a machine crash were to occur.
 
note
For more information about the keywords that you can use when you enter the command this way, refer to the description of SAVE in the PV‑WAVE Reference.
 
caution
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 RESTORE Procedure
The RESTORE command restores the objects previously saved in a save file when you used 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.
 
note
For a description of these keywords, see the description of RESTORE in the PV‑WAVE Reference.
Things to Remember when Restoring Files
Situations in which the contents of the file will not be restored are:
*When attempting to restore a structure variable, the structure of the saved variable must either not exist, or must agree with the existing structure definition. If the structure is already defined and does not match, RESTORE issues an error message, skips the variable in question, and continues with the next variable in the file. This also applies to system variables.
 
note
Rogue Wave Software, Inc., reserves the right to change the structure of PV‑WAVE system variables, although such changes are not anticipated. Generally, there is little need to save system variables, so this restriction is not a problem.
*Read-only system variables are not restored. RESTORE quietly skips over such variables in the file unless the Verbose keyword is present. In this case an informative message is issued as the variable is skipped.

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