GetPosition method: File class
Syntax
GetPosition()
Description
The GetPosition method returns the current read or write position in the external file. GetPosition works only with a file that was opened in Update mode. This method is designed to be used in combination with the SetPosition method to establish checkpoints for restarting during file access.
Note:
Currently, the effect of the Update mode and the GetPosition and SetPosition methods is not well defined for Unicode files. Use the Update mode only on files stored with a non-Unicode character set.
Parameters
None.
Returns
A number representing the current read or write position in the file.
Note:
When you use ReadRowset to read from a file in Update mode, the CurrentRecord property returns, the entire record just read. The current read/write position is at the end of the CurrentRecord, that is, just past the end of the rowset.
Example
The following example opens a file in Update mode, and saves the current position after each read operation:
&MYFILE.Open(&SOMENAME, "U");
If &MYFILE.IsOpen Then
while &MYFILE.ReadLine(&SOMESTRING)
&CURPOS = &MYFILE.GetPosition();
/* Save the value of &CURPOS after each read,
and process the contents of each &SOMESTRING */
End-While;
End-If;
&MYFILE.Close();