INPUT
PURPOSE:
INPUT and READ are synonyms. However most programmers have
chosen to use INPUT when interacting with the FID(0) device. The following
information is for the FID(0) device.
For disk file input see READ.
For information specific to the PC3 screen driver see
PC3 Screen Driver and
PC3 Mnemonics
For information on the PC3 Web view access see
READ GUI.
WRITE GUI
STATEMENT SYNTAX:
{stno} INPUT{RECORD} {(unit{,ERR=}{,TBL=}{,TIM=}{,SIZ=})}
{@(expr{,expr}),},{output constants}
{input var list}{IOL=stno}
where:
unit = a device number assigned to the device by means of the
OPEN statement - the "unit" is omitted or 0 to
identify the FID(0) device(which is always open).
@(expr,expr) = optional positioning expression(s)
output constants = optional, one or more string constants or
constant expressions to be displayed.
input var list = one or more string or numeric variables
into which data is input. If the RECORD modifier has been used this
is a single variable.
EXAMPLE:
INPUT Y$
0100 INPUTRECORD (0,ERR = 0090,SIZ = 3,TBL = 9000) "What:",J$
0200 INPUT (0,ERR = 1090) 'CS',@(0,2),"String:",S$,@ (20,2) ,"Number:",N
0300 INPUT IOL = 590
NOTES:
1. The INPUT command provides for a 2-way transfer
of data between the user and the program.
Output prompts to the FID(0) device are provided through the use of constants.
Input from the pc keyboard is provided through the use of any string
or numeric variable. Input and output can both be positioned on the screen
through the use of the "@" positioner. Input from the keyboard suspends the
program until the input is terminated. The data that precedes the termination character
is stored away in the associated variable, and then the system variable, CTL,
is set to indicate the terminating character.
The assigning of data to keys is easily changed the following is how
SM32 is distributed:
In the SM32 setup the PC keys F1->F4 have the values $9C$->$9F$ assigned to them.
Then the $__SETUP program (that is called at start up) has the following lines:
105 REM set 9C->9F to ctl 1->4
110 LET A$=$00000A000D009C019D029E039F04$
115 LET A$=STBL("!TERMS",A$)
This causes the enter key,CTRL J,F1->F4 to be keys that will terminate an INPUT.
returning the following CTL values:
enter key - 0
CTRL J - 0
F1 - 1
F2 - 2
F3 - 3
F4 - 4
2. Under normal circumstances, all characters entered on the keyboard
will be immediately displayed on the screen at the current cursor position.
This echo can be inhibited by use of the 'EE' mnemonic (END ECHO) or by using a
device number other than 0. For example:
OPEN(3)FID(0)
INPUT (3)"Input won't appear",S$
Then any KEYBOARD entry "for" S$ will not be displayed.
3. Any attempt to enter non-numeric data into a numeric variable will
result in an ERROR. This error can be "TRAPPED" by the ERR= option in the command.
4. INPUT VERIFICATION is possible within the INPUT command itself,
and can take one of two forms:
NUMERIC VERIFICATION
INPUT {file param}var:(expr)
where expr is a numeric expression. If expr is positive the input must be
greater than or equal to 0 and less than or equal to expr. If expr is negative
the input must be greater than or equal to expr and less than or equal to -expr.
If the input is outside the verification range var still receives the input
numeric but an error 48 is also generated.
STRING VERIFICATION
INPUT file paramstrvar:(blist,LEN=min,max)
where: blist = one or more items, separated by commas, with the
format string expression=stno. If a TRUE condition is found control
is passed to stno.
min,max = the inclusive range of legal lengths of input. If no blist is
specified, or if the input does not match any literal in blist, the LEN
specification is checked.
If LEN = does not exist, or if the length of the input is outside the
given range of "min" and "max", an ERROR 48 will be generated.
Otherwise execution continues at the next executable statement in sequence.
EXAMPLE:
0150 INPUT(0,ERR=0150)X$:(""=0200,"A"=0250,
0150:"B"=0300,"YES"=0350,"NO"=0400)
If "" entered, transfer to statement 200
If "A" entered, transfer to statement 250
If "B" entered, transfer to statement 300
If "YES" entered, transfer to statement 350
If "NO" entered, transfer to statement 400
Entry of anything else will force execution to return to the same INPUT command.
0900 SETERR 0905
0905 INPUT X$:("END"=0950,LEN=1,1)
0910 SETERR 0
0920 GOTO 0960
0950 STOP
If "END" was entered, transfer to line 0950, entry of ANY 1
character will cause execution to continue at line 0910.
Entry of "" or ANYTHING more than 1 character will cause an ERROR
and transfer control back to line 0905 (via the SETERR command)
5000 INPUT(0,ERR=5010)X$:("STOP"=4000,LEN=10,12)
5005 GOTO 5050
5010 IF CTL>1 THEN STOP ELSE GOTO 5000
5050 ............
If "STOP" was entered, transfer to line 4000
Entry of 10 to 12 characters will cause a transfer to
line 5005 (no ERROR). Entry of ANYTHING ELSE will cause a transfer
to line 5010. There, a check on the INPUT TERMINATOR is made.
7500 INPUT(0,ERR=7500)X$:(LEN=0,5)
7510 IF X$="" AND CTL>1 GOTO 7600
If 0 to 5 characters were entered, transfer of
control will drop through to line 7510 Else, the INPUT command will be repeated.