11 - 95 11 - 95
MELSEC-Q
11 INSTRUCTIONS AND FUNCTIONS
INPUT#
Instruction
INPUT #
• Reads data from a sequential file.
INPUT # <file number>, <variable name> [, <variable name> , …]
file number
• • • •
Specify the file number of the sequential file that was
opened by the OPEN instruction.
Syntax
variable name
• • • •
Specify the variable where the read data is stored.
Examples
INPUT#2, A
• • • •
Reads numeric data from the sequential file that was
opened by file number 2, then assigns it to A.
Description
• The INPUT# instruction reads data from a sequential file and stores it in a variable.
• <file number> is the number used for opening the sequential file for input by the OPEN
instruction.
• <variable name> indicates a variable where the data item in the file is assigned to. The
type of the data item in the file must match that of the variable name.
• If the data item is a numeric value, the first character other than space, enter, and line feed
is considered as the beginning of the numeric value and the end of the numeric value is
indicated by a space, enter, line feed, or comma.
• When reading a data item of a character string, the first character other than space, enter,
or line feed is considered as the beginning of the character string data item.
If this first character is a double quotation mark (“), the character string includes all
characters between the first double quotation mark and the second double quotation mark.
A double quotation mark cannot be included as a character in a character string that is
enclosed by double quotation marks.
If the first character of a character string is not a double quotation mark, the end of the
character string is indicated by either a comma or Enter.
The maximum number of characters that can be read is 255.
If there is no delimiter (Enter, comma) within 255 characters, the entire 255 characters are
read as one character string.
• If the program reaches the end of file while reading numeric data or character string data,
the data item ends at that point.
REMARK
See the INPUT$ and LINE INPUT# functions, LOF and OPEN instructions, and
Chapter 6.