INPUT @ Statement

The INPUT@ statement is a variation of the INPUT statement. INPUT@ maintains formatted screens and provides format masking.

Format

INPUT @(x,y) var [,length] [mask]

Parameter(s)

var

Name of the variable to which user input is assigned.

length

Maximum length of the field to be input. Once length characters have been input, an automatic carriage return and linefeed is assumed, as in the standard INPUT statement.

mask

Format mask of the form specified by the FMT function.

Description

The INPUT@ statement is in many ways an enhancement on the INPUT statement, in that it allows the location on the screen at which the user is prompted to be directly specified. It also provides direct format masking so that input is not accepted if it does not follow the desired mask.

Using the standard INPUT statement, the user would have to precede the INPUT statement with the proper PRINT statement (using the @ function) to position the cursor at a specific coordinate on the screen. Also, with the standard INPUT statement, a loop would often have to be used with several tests to ensure that the input matches a particular format.

When the user is prompted, the prompt character appears one space to the left of the coordinate (x,y), and the current value of var (if any) is printed (in the specified mask). The user may accept the current value by pressing ENTER, or can type in another value. The user continues to be prompted until the input follows the requested format. When input matches the mask, it prints in its external format and then stored in the variable var in its internal format.

If the original value of var does not follow the required format, no error is output.

NOTE

The INPUT@ statement does not accept any of the other screen manipulation codes available with the @ function (such as clearing the screen or providing text in a standout mode).

Example

In this application the INPUT@ function is used to prompt for the salary and starting date of a new employee.

**** NEXT 3 LINES :  PRINT THE 3 FORMATTED ROWS

   FOR INPUT

PRINT @(-1) : @(10,10) : "YOUR NAME" :

PRINT @(10,12) : "NEW SALARY" :      

PRINT @(10,15) : "EFFECTIVE DATE" :  

**** INPUT FOR NAME AT PROPER COLUMN, ROW

INPUT @(30,10) NAME              

**** INPUT FOR SALARY, WITH MONETARY FORMAT

   MASK

INPUT @(30,12) SALARY "R2,"      

**** INPUT FOR DATE EFFECTIVE, WITH DATE FORMAT

   MASK

INPUT @(30,15) DATE "D"

See Also

Statement and Function Reference