Navigation: Language Reference > 13 - Built-in Functions >====== STREAM (enable operating system buffering) ====== | |
STREAM(file)
STREAM | Disables automatic FILE flushing. |
file | The label of a FILE. |
Some file systems flush the operating system's buffers on each disk write keeping the file “logically closed” (for example, the Clarion and TopSpeed file drivers do this by default). The STREAM statement disables this automatic flushing operation. A STREAM operation is terminated by closing the file, which automatically flushes the buffers, or by issuing a FLUSH statement.
STREAM and FLUSH are inherently single-user, batch process type of statements, although you can use them in networked environments. In some file systems, STREAM and FLUSH are simply ignored when the file is opened for shared access while in others they execute but it is possible to create a “deadlock” situation between workstations for multiple file updates. LOGOUT accomplishes a similar purpose in multi-user environments and is much safer.
Support for this statement is dependent upon the file system and is described in its file driver's documentation.
Example:
STREAM(History) !Use DOS buffering
SET(Current) !Set to top of current file
LOOP
NEXT(Current)
IF ERRORCODE() THEN BREAK END
His:Record = Cur:Record
ADD(History)
END
FLUSH(History) !End streaming, flush buffers
See Also: