User Tools

Site Tools


getstate_return_current_state_of_data_file_.htm
Navigation:  Language Reference > 13 - Built-in Functions >====== GETSTATE (return current state of data file) ====== Previous pageReturn to chapter overviewNext page

GETSTATE(file [ ,saveblob ])

blk2blue.jpg

GETSTATE Identifies a file's current state including the record buffer, file pointer, file sequencing order, and the error state of the system.
file The label of a FILE declaration.
saveblob An integer constant or variable containing either zero (0) or one (1). If one, the state of the BLOB is also returned. If omitted or zero (0) the BLOB state is not returned.

GETSTATE returns the current state of the data file. This includes the record buffer, MEMOs, BLOBs, file pointer, file sequencing order, and the current error state of the system. Use GETSTATE to store the file's state so it can be restored using RESTORESTATE. This set of functions, (including FREESTATE), allow for easy interruption and resumption of sequential file processes.

GETSTATE can now save the state of BLOBs if the second parameter is set to TRUE. It defaults to not saving BLOBs.

Return Data Type: LONG

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,1)      !save current state of file and BLOB

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:

FREESTATE

RESTORESTATE

getstate_return_current_state_of_data_file_.htm.txt · Last modified: 2021/04/15 15:57 (external edit)