TFLSH
|
USupported on Unix
|
VSupported on OpenVMS
|
|
xcall TFLSH([channel[, mode]])
Arguments
channel
(optional) A channel opened to a serial device. (n)
mode
(optional) A nonzero mode value indicates that any outstanding buffered output characters should be purged. (n)
Discussion
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:
- The terminal buffer is full.
- One of the following operations has occurred: READS, GETS, ACCEPT, SLEEP, XCALL TTSTS, XCALL WAIT, or %TTSTS.
- Error conditions exist.
- The end of the program is reached.
You can customize the size of the terminal buffer by setting system option #12 and the environment variable TBUF.
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.
Examples
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 xcall long_job