# INPUT Get Input from Terminal

> Source: https://manual.pvxplus.com/directives/input

## Format

**INPUT** \[**EDIT**\] (\[*chan*\]\[,*fileopt*\])*varlist*  

***Where:***

|  |  |
| --- | --- |
| *chan* | Channel or logical file number of the file from which to get terminal input. |
| *fileopt* | Supported file options (see **[File Options](https://manual.pvxplus.com/appendix/input-output-and-control-options#Mark1)**):<br>\|  \|  \|<br>\| --- \| --- \|<br>\| **BSY**=*stmtref* \| Traps Error #0: Input timeout \|<br>\| **ERR**=*stmtref* \| Error transfer \|<br>\| **HLP**=*string$* \| Help message identifier \|<br>\| **IND**=*num* \| Position cursor to specified column number \|<br>\| **LEN**=*num* \| Limit on input size \|<br>\| **SIZ**=*num* \| Number of characters to read (number of screen columns) \|<br>\| **TBL**=*stmtref* \| Data translation table \|<br>\| **TIM**=*num* \| Maximum time-out value in integer seconds \|<br>\| *stmtref* \| Program line number or statement label to which to transfer control \| |
|  | When screen positions are tight, you can combine the **LEN=** and **SIZ=** options to have the system supply a scrolling input field.  <br>  <br>***Example:***  <br>  <br>To allow a user to enter 60 characters in a field where you only have room for 30 on the screen:  <br>  <br> input (0,len=60,siz=30)"Name....:",N$ |
| *varlist* | Comma-separated list of variables, literals, mnemonics, **IOL=** options, and/or location functions **'@(...)'**. Include **[Format Masks](https://manual.pvxplus.com/appendix/data-format-masks)** to filter data being received. |

## Description

Use the **INPUT** directive to issue prompts and to receive input from a terminal device. You would normally use the logical file number to refer to a terminal. Input from the user is stored in a variable specified. PxPlus treats any literals or expressions included in the statement as prompts. When a numeric variable is specified, numeric data must be received. Non-numeric input in response to a numeric variable (other than commas and decimals) will cause an Error #26: Variable type invalid.

If you use the **EDIT** clause, the current values for the variables are loaded into the input buffer so that the user can edit them.

Use a format mask with the **INPUT** directive to control the input. To do this, append a **:** (*colon*) and the mask to the given variable in *varlist*. If you omit a format mask for a numeric in an **INPUT** statement, the **'DP'** (Decimal Point Symbol) and **'TH'** (Thousands Separator) system parameters are ignored for European decimal settings.

If an **INPUT EDIT** statement has both a format mask and a validation list, make sure that the validation list contains only entries that are possible. For example, if the format mask indicates that the input value must be a single character, do not use a null ("") value in the validation list. Instead, valid input for "no value" could be a blank/space in this instance:

```
0030 input edit (0,err=0030)@(10,10),VAR$:"A":("Y"=0040,"N"=0050,""=0060)
```

A validation list may contain literals, simple variables, or sub-stringed variables.

Use the **IND=** option to set the position of the cursor in the **INPUT** field. Use IND(*chan*) to obtain the position where the cursor was left after the **INPUT**.

*(The ability to use a sub-stringed variable was added in PxPlus v6.30.)*

## See Also

[ACCEPT Read Single Keystroke](https://manual.pvxplus.com/directives/accept)  
[OBTAIN Get Hidden Terminal Input](https://manual.pvxplus.com/directives/obtain)  
['ME' Begin Edit Mode](https://manual.pvxplus.com/mnemonics/me)  
['BI' Begin Input Transparency](https://manual.pvxplus.com/mnemonics/bi)  
[Data Format Masks](https://manual.pvxplus.com/appendix/data-format-masks)

## Example

```
input 'CS',@(5,5),"Enter customer number:",C
input edit "Enter value:",INV_AMT:"$##,##0.00"
```

Use **IND**=*x* as a parameter for the **INPUT** statement to set the starting point in an input field.

***Example:***

To start the input at the tenth character of A$:

```
A$="Now is the time"
input edit (0,ind=10) A$
```

Use **IND(0)** to find out the character position where the user terminated input. For example, if the user enters "Now is the time" and presses **Home** and **Tab**, the cursor moves to the 10th position, just after the "e" in "the". Then, if the user presses **Enter** or any other function key to terminate the input, the value returned in **IND(0)** is 10.
