String instructions
270
Part II IEC Instructions
CONCAT
Concatenate (attach) a string
To add an enable input and enable output to the instruction, select [With EN/ENO] from the
"Instructions" pane (LD, FBD or IL editor). To reuse an instruction select "Recently used" from the
context menu or press <Ctrl>+<Shift>+<v> in the programming window.
PLC types
Availability of CONCAT (see page 1318)
If the output string is longer than the length defined for the output
variable (output_string) in the field "Type", only as many characters
are copied, starting from the left, as the output variable can hold. The
special internal relay R9009 (%MX0.900.9) is set.
The number of steps may vary depending on the PLC and parameters
used, see also Table of Code Intensive Instructions in the online help.
Data type I/O Function
STRING 1st input beginning input string
STRING 2nd input string that will be attached to the beginning string
STRING output resulting string
No. IEC address Set If
R9007 %MX0.900.7 permanently
R9008 %MX0.900.8 for an instant
input string is longer than the length
defined for the input variable in the field
"Type"
R9009 %MX0.900.9 for an instant output string is longer than the length
defined for the output variable in the field
"Type"
In this example, the same POU header is used for all programming languages. For an example
using IL (instruction list), please refer to the online help.
In this example the input variables (input_string1, input_string2 and input_string3) have been
declared. However, you may enter the strings ('Ideas', ' for' and ' life') directly into the function.
The strings have to be put in inverted commas, both in the POU header and in the function.
Description
CONCAT concatenates (attaches) the second and the following input strings (IN1 + IN2 + ...) to the
first input string and writes the resulting string into the output variable.
Data types
Error flags
Example
POU header
All input and output variables used for programming this function have been declared in the POU
header.
Body
Input_string3 (‘ life’) is attached to input_string2 (‘ for’) and this string is attached to
input_string1 ('Ideas'). The resulting string (‘Ideas for life’) is written into output_string.