TA Function

The TA function returns the number of characters in the type-ahead buffer for the current process, or for any other line.

Format

TA(expr)

Parameter(s)

expr

An expression evaluating to the line number of the process to be checked. If expr evaluates to any negative number, the number of characters in the type-ahead buffer for the line linked to that process is returned. If expr evaluates to a number greater than the allowable maximum number of users, -1 is returned to indicate an error.

Description

When the type-ahead feature is on for a terminal, the TA function returns the number of characters in the type-ahead buffer. The type-ahead buffer holds a maximum of 127 characters at a time. If the type-ahead feature is off, the TA function returns 0.

To toggle the type-ahead feature on and off for the current process, the TA ON and TA OFF statements may be used. To clear the type-ahead buffer for the current process, the TA CLEAR or INPUTCLEAR statement may be used. See TA Statement for more information on controlling the type-ahead feature for the current process or for any other process.

NOTE

On the console port, the TA function returns a count of two characters for every character in the type-ahead buffer. The first character expresses how the character is to be displayed, and the second character is the actual character in the type-ahead buffer.

Example

In this application, preparations are made for dialing a remote system via a modem, which is connected to a line MODEMLINE. Before sending the modem commands, the program checks the type-ahead buffer for the line, and clears the type-ahead buffer via the PROTOCOL command if it is not empty.

EXECUTE "LINE-ATT " : MODEMLINE

CHARS.IN.TA = TA(MODEMLINE)

IF CHARS.IN.TA <> 0 THEN

   EXECUTE "PROTOCOL " : MODEMLINE : " (C)"

END

See Also

Statement and Function Reference