11 - 344 11 - 344
MELSEC-Q
11 INSTRUCTIONS AND FUNCTIONS
Instruction
• Displays data on the screen.
PRINT [<data to be displayed>][;]
Syntax
data to be displayed
• • • •
Specify the numeric values, numeric variables,
character strings, or character string variables to be
displayed.
PRINT “ABC”
• • • •
Displays ABC.
PRINT “ABC”,”DEF”
• • • •
Displays 14 characters starting with ABC, and then
14 characters starting with DEF.
Examples
PRINT “ABC”;”DEF”
• • • •
Displays ABCDEF.
Description
• The PRINT instruction displays data on the screen.
• Data is displayed on a console or terminal specified by the ZODV instruction.
• If <data to be displayed> is omitted, one line of blank space is displayed.
• A character string must be enclosed with double quotation marks (“).
• The position where the value of <data to be displayed> is displayed is determined by the
symbol used to separate two items of <data to be displayed>.
In BASIC, one line is divided into areas, each of which contains 14 characters.
If two items of <data to be displayed> are separated by a comma (,), the second item of
<data to be displayed> is displayed starting from the beginning of the next area.
If two items of <data to be displayed> are separated by semicolon (;), the second item of
<data to be displayed> is displayed following the first character string in immediate
succession.
Note, however, that a comma (,) cannot be used to separate items of <data to be
displayed> unless the data is to be displayed on the console screen. An error occurs if a
comma is used.
Furthermore, if a space is used to separate items of <data to be displayed>, the same
result as when a semicolon is used will be obtained.
• If only a comma (,) is placed following the <data to be displayed> of the PRINT instruction,
the data of the next PRINT instruction is displayed starting from the next area. If only a
semicolon (;) is placed following the <data to be displayed>, the data of the next PRINT
instruction is displayed following the data of the previous PRINT instruction in succession.
ABCDEF
ABC DEF
PRINT "ABC" ,
PRINT "DEF" ,
PRINT "ABC" ;
PRINT "DEF" ;
14
characters
14
characters
• If no comma or semicolon is specified, a new line starts after the corresponding line is
displayed.
• If the line to be displayed exceeds the line width of the screen, the remaining data is
displayed in the next line.
• When a value is displayed, a blank space is always appended to it. In addition, a blank
space is placed immediately before a positive numeric value, and a negative sign (-) is
placed immediately before a negative numeric value.
REMARK
See the LOCATE, PRINT USING, SPC and TAB instructions, and Section 3.10.