| **Navigation:**  [[abc library reference.htm|ABC Library Reference]] > FileManager > FileManager Methods >====== SaveFile (save the current file state) {{c6h0009.jpg|C6H0009.jpg}} ====== | [[savebuffer save a copy of the record buffer .htm|{{btn_prev_n.gif|Previous page}}]][[abc library reference.htm|{{btn_home_n.gif|Return to chapter overview}}]][[seterror save the specified error and underlying error state .htm|{{btn_next_n.gif|Next page}}]] | | || **SaveFile** {{blk2blue.jpg|blk2blue.jpg}} The **SaveFile **method saves the managed file's current state and returns a number that uniquely identifies the saved state. SaveFile saves the managed file's state for subsequent restoration by the RestoreFile method. **Implementation:** The SaveFile method saves file position, as well as any active HOLD or WATCH. SaveFile calls the SaveBuffer method to save a copy of the managed file's record buffer contents. **Return Data Type:**     USHORT **Example:** **SaveState USHORT               !must be a USHORT** ** CODE** ** SaveState = Access:MyFile.SaveFile()  !save the file state** ** SET(MyKey,MyKey)              !access the file (change the file state)** ** LOOP UNTIL Access:MyFile.Next()** **  !Check range limits here** **  !Process the record here** ** END** ** Access:MyFile.RestoreFile(SaveState)  !restore the previously saved file state** **See Also:**     [[restorefile restore a previously saved file state .htm|RestoreFile]], [[savebuffer save a copy of the record buffer .htm|SaveBuffer]]