Get Input from Terminal


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


Channel or logical file number of the file from which to get terminal input.


Supported file options (see File Options):


Traps Error #0: Input timeout


Error transfer


Help message identifier


Position cursor to specified column number


Limit on input size


Number of characters to read (number of screen columns)


Data translation table


Maximum time-out value in integer seconds


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.


To allow a user to enter 60 characters in a field where you only have room for 30 on the screen:

     input (0,len=60,siz=30)"Name....:",N$


Comma-separated list of variables, literals, mnemonics, IOL= options, and/or location functions '@(...)'. Include Format Masks to filter data being received.


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
OBTAIN Get Hidden Terminal Input
'ME' Begin Edit Mode
'BI' Begin Input Transparency
Data Format Masks


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.


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.