Introduction | Language Structure | IB Statements | File System | Comet 32 Runtime | Index |
Syntax: | INPUT [(lun)] variable-list [,EXCP=statement-label | NOEXCP]
Note: If no lun is specified, the INPUT statement assumes lun 0. | ||||||||
Discussion: |
The INPUT statement allows simple, unformatted input into
specified variables without necessarily having to reference a
FORMAT statement.
The variable-list consists of one or more variable names, separated by semicolons. Note: Each variable in a multi-variable list requires a separate operator transmission (see I/O Format Division for more information). The length of a string field is governed by its current length, and not by the declared length. Because unformatted input is given field-by-field, trailing blanks are stripped from each string variable in the list. This is unlike the READ statement where trailing blanks are stripped only from the last string variable listed in the FORMAT statement, and all variables are input with a single transmission. Using INPUT with a single variable is a convenient way to cause the system to strip the trailing blanks. As the record is placed in the variable (string), the current length is adjusted for the blank stripping. If you do not include a decimal point in a numeric variable, it is automatically inserted according to the declared precision of the variable. Excess characters are truncated on the left. If you do include a decimal point in a numeric variable, INPUT will adjust it with the declared precision. Excess characters (on both the left and the right) are truncated. Although unformatted INPUT is primarily used for video terminal input, it can also be used for multiple sequential reads of any type of file into a list of single variables, one for each record. INPUT can also refer to a FORMAT statement. It functions the same way as a non-indexed READ statement. In this case, the syntax is: INPUT (lun,format-statement-label) [,EXCP=statement number] Note: Another form of the INPUT statement exists. It creates an input field without transmit marks. See the new INPUT statement for more information. | ||||||||
History: |
The INPUT statement was enhanced in Comet version 504.208.
Additional status information is available following
the execution of an INPUT statement. This information
includes the location of the cursor when the INPUT occurred,
and a flag that identifies the keyboard action that caused
the INPUT.
| ||||||||
Example 1: |
PRINT (0) "ENTER CUSTOMER NAME:" ! Display prompt INPUT (0) CUSTNAME$ ! Enter data | ||||||||
Example 2: |
1000 FORMAT NAME$;ADDRESS$;CITY$;STATE:ZIP$ . . . PRINT (0,500) ! Formatted screen INPUT (0,1000) ! Input items in FORMAT statement | ||||||||
Example 3: |
INPUT (0) A$;B$;C$ (or) 100 FORMAT A$;B$;C$ . . . INPUT (0,100)The first INPUT statement requires a separate transmission for each of the three fields. Also, blanks are stripped from each field. In the second example, only one transmission is required (as shown by the single INPUT statement). In this case, blanks are stripped only from the final field (C$ in the above example). | ||||||||