Retrieve memory variables from a memory (.mem) file
RESTORE FROM <xcMemFile> [ADDITIVE]
<xcMemFile> is the memory (.mem) file to load from disk. If an extension is not specified, the extension .mem is assumed. The file name may be specified as a literal string or as a character expression enclosed in parentheses.
ADDITIVE causes memory variables loaded from the memory file to be added to the existing pool of memory variables.
RESTORE is a memory variable command that recreates public and private variables previously SAVEd to a memory (.mem) file and initializes them with their former values. The scope of the variable is not SAVEd with the variable, but is instead established when the variable is RESTOREd. Arrays and local variables cannot be SAVEd or RESTOREd.
When memory variables are RESTOREd, they are recreated as private variables with the scope of the current procedure or user-defined function unless they exist as public variables and you specify the ADDITIVE clause. If ADDITIVE is specified, public and private variables with the same names are overwritten unless hidden with PRIVATE. If ADDITIVE is not specified, all public and private variables are released before the memory file is loaded.
Local and static variables are unaffected by RESTORE. If a local or static variable has been declared in the current procedure or user- defined function and a variable with the same name is RESTOREd, only the local or static variable is visible unless references to the RESTOREd variable are prefaced with the MEMVAR alias.
. This example demonstrates a typical application of SAVE and RESTORE. Here memory variables containing screens are SAVEd TO and RESTOREd FROM memory files: // Create and use a pseudoarray of screens SAVE SCREEN TO cScreen1 SAVE ALL LIKE cScreen* TO Screens // <statements>... // RESTORE FROM Screens ADDITIVE nNumber = "1" RESTORE SCREEN FROM ("cScreen" + nNumber)
LOCAL, PRIVATE, PUBLIC, SAVE