11 - 346 11 - 346
MELSEC-Q
11 INSTRUCTIONS AND FUNCTIONS
[Format specification for a character string]
In order to display a character string using the PRINT USING instruction, it is necessary to
employ one of the following format characters to determine the format of the character
string.
Format character
Function
Example
“!”
Displays the starting character of a given character
string.
PRINT USING “!” ;” ABC”
A
OK
“& n spaces &”
• Displays 2 + n characters from the beginning of a
given character string.
• Displays 2 characters if no space is specified
between the two & characters.
• If a given character string is longer than the length
specified in the format, the extra characters are not
displayed.
• A given character string is displayed left-justified
and blank spaces are placed for any remaining
character spaces of the format.
PRINT USING “& &” ;” ABCD”
ABCD
OD
PRINT USING “& &” ;” ABCD” ;” EFGH”
ABCDEFGH
OK
PRINT USING “& &” ;” AB” ;” CD”
AB CD
OK
[Format specification for a numeric value]
In order to display a numeric value using the PRINT USING instruction, it is necessary to
employ one of the following special characters to determine the format of the numeric value.
Format character
Function
Example
“#”
• Indicates the place of each digit of a numeric value.
• A number or a space must be placed at the place
of the digit where this character is specified.
• If the number of digits of a value to be displayed is
less than the specified number of digits, the
numeric value is displayed right-justified according
to the format and blank spaces are placed for any
remaining digit spaces to the left.
• If a numeric value has more digits than the number
of # characters, a "%" character is displayed at the
beginning.
PRINT USING “ ####” ;123
123
OK
PRINT USING “ ##” ;123
%123
OK
(Continued on the next page)