| **Navigation:**  [[introduction.htm|Language Reference]] > 13 - Built-in Functions >====== FREESTATE (free resources) ====== | [[free delete all entries .htm|{{btn_prev_n.gif|Previous page}}]][[introduction.htm|{{btn_home_n.gif|Return to chapter overview}}]][[freeze suspend control redrawing .htm|{{btn_next_n.gif|Next page}}]] | | || **FREESTATE(**//file//,// savedstate//**)** {{blk2blue.jpg|blk2blue.jpg}} | **FREESTATE** | Releases all resources allocated by GETSTATE | | //file// | The label of a FILE declaration. | | //savedstate// | A LONG numeric variable which represents the value returned by the GETSTATE procedure. | FREESTATE releases all resources allocated by GETSTATE. **Example:** **MyFunction PROCEDURE(FILE MyFile)** **CurState LONG** **  CODE** ** ! File will be in the same state on exit of this procedure as it was on entry** ** CurState = GETSTATE(MyFile)       !save current state of file** ** SET(MyFile)                       !ready to access file** ** NEXT(MyFile)                      !read a record** ** CLEAR(MyFile)                     !clear record buffer** ** RESTORESTATE(MyFile, CurState)    !restore file to initial state** ** ****FREESTATE****(MyFile, CurState)       !release resources** **See Also:** [[getstate return current state of data file .htm|GETSTATE]] [[restorestate restore state of data file .htm|RESTORESTATE]]