Open topic with navigation
USupported on UNIX
VSupported on OpenVMS
xcall TFLSH([channel[, mode]])
(optional) A channel opened to a serial device. (n)
(optional) A nonzero mode value indicates that any outstanding buffered output characters should be purged. (n)
The TFLSH subroutine flushes the terminal or serial device buffer. It has different functions on UNIX and OpenVMS.
TFLSH on UNIX
Normally, terminal output is buffered, and the terminal buffer is automatically flushed on each DISPLAY or WRITE statement. However, by setting system option #12 with the DBLOPT environment variable, you can buffer terminal output across several statements. You can then use the TFLSH subroutine to explicitly flush the terminal buffer.
The terminal buffer is also flushed under the following conditions:
You can customize the size of the terminal buffer by setting system option #12 and the environment variable TBUF. Refer to TBUF and option #12 for more information about the TBUF environment variable and system option #12, respectively.
You can also specify a channel open to a serial device. In this case, the TFLSH subroutine can be used to wait for I/O to be sent to a device or to purge pending output.
A mode value of one is equivalent to runtime PURGE functionality setting. A mode value of zero is equivalent to CLOSE functionality except that the channel is not closed.
TFLSH on OpenVMS
Terminal I/O is asynchronous. The TFLSH subroutine ensures that the previous asynchronous terminal I/O has completed.
The following example is part of an application that uses buffered terminal output on a UNIX system. This code should only be used when system option #12 is set, or it won’t do anything useful. Without option #12, output is only buffered for each individual statement.
display(TTCHN, $scr_att(blink, bold), "Working ...", $scr_att(clear)) xcall tflsh ;Make sure message is displayed