11 - 349 11 - 349
MELSEC-Q
11 INSTRUCTIONS AND FUNCTIONS
PRINT#
Instruction
PRINT#
• Writes data to a sequential file.
PRINT #<file number>, <data to be written>
file number
• • • •
Specify the file number of a file opened as a
sequential file using the OPEN instruction.
Syntax
data to be written
• • • •
Specify the numeric values or character string
expressions to be written to the file.
PRINT #1,A
• • • •
Writes the value of A to the file opened as file
number 1.
Examples
PRINT #2,A$
• • • •
Whites the character string A$ to the file opened as
file number 2.
Description
• The PRINT# instruction writes data to a sequential file.
• In order to use the PRINT# instruction, it is necessary to open a sequential file using the
OPEN instruction in advance.
• The PRINT# instruction writes data to a sequential file in the same manner as data is
displayed on the display screen using the PRINT instruction. Therefore, it is necessary to
use semicolons (;) to separate numeric expressions and character string expressions in
<data to be written>.
If a comma (,) is used instead of a semicolon (;) to separate expressions, any extra
spaces that would be inserted when displaying numeric values and characters, are also
written to a file.
• The PRINT# instruction does not display data on the screen.
REMARK
See the OPEN, INPUT#, LINE INPUT#, CLOSE PRINT, PRINT USING and PRINT#
USING instructions, and Chapter 6.