TA Statement

The TA statement controls the type-ahead feature.

Format

TA {ON | OFF | CLEAR}

INPUTCLEAR

Parameter(s)

ON

Turns the type-ahead feature on (default). The operator is able to respond to future input requests before they are prompted for.

OFF

Turns the type-ahead feature off. The operator must be at a prompt before input is accepted.

CLEAR

Clears the type-ahead buffer. Same as INPUTCLEAR.

Description

When the type-ahead feature of a terminal is on, characters typed by the operator are kept in the type-ahead buffer, and are applied to the next input request in the program. Thus, an operator familiar with a program can type answers to questions without waiting for the prompt.

The type-ahead feature is normally on for a terminal. The TA OFF statement turns this feature off, and the TA CLEAR or INPUTCLEAR statement clears any data currently in the type-ahead buffer. The maximum number of characters which the type-ahead buffer accepts at a given time is 127. The intrinsic function TA may be used to return the number of characters currently in the type-ahead buffer. See TA Statement for more information.

The INPUTIF statement accepts input only from the type-ahead buffer. See INPUTIF Statement for more information.

The TA ON and TA OFF statements affect all lines attached to the current process, but the TA CLEAR statement clears only the type-ahead of the line linked to the process, and has no effect on any attached lines. To clear the type-ahead buffer for another line (whether attached or not), use the PROTOCOL command with the C option within an EXECUTE statement. To toggle the type-ahead feature on or off for an unattached line, the TCL statements TA-ON and TA-OFF may be used via an EXECUTE statement.

NOTE

If the TA ON statement is used within a program, a TA OFF statement should follow before the program terminates. The type-ahead feature will not be reinstated at the end of a program.

Example

In this application, a menu program turns off the type-ahead feature before looping through the menu. Since a single character is taken as a directive in the program, turning off the type-ahead feature prevents hasty, unintentional input. Note that a TA ON statement is placed at the end of the program, to re-enable the type-ahead feature.

An alternative way of dealing with the type-ahead feature in this program would be to place a TA CLEAR statement before accepting the menu choice.

TA OFF    

RESPONSE = ""  

LOOP UNTIL RESPONSE = "5" DO  

   PRINT @(-1) : "CHOOSE ONE : " :  

   PRINT @(4,4) : "1. SHOW AN ENTRY" :    

   PRINT @(4,6) : "2. DELETE AN ENTRY" :  

   PRINT @(4,8) : "3. CREATE A NEW ENTRY" :  

   PRINT @(4,10) : "4. CHANGE AN EXISTING ENTRY" :

   PRINT @(4,12) : "5. QUIT" :   

   PRINT @(0,23) : "PRESS 1, 2, 3, 4 OR 5 : " :    

   INPUT RESPONSE,1 :  

   BEGIN CASE  

   .

   .

   .

   END CASE    

REPEAT    

TA ON

See Also

Statement and Function Reference