614 Rockwell Automation Publication 1756-RM003N-EN-P - October 2011
Chapter 18 ASCII String Instructions (CONCAT, DELETE, FIND, INSERT, MID)
Find String (FIND)
The FIND instruction locates the starting position of a specified string within another
string.
Operands:
Relay Ladder
Structured Text
The operands are the same as those for the relay ladder FIND instruction described
above.
Description: The FIND instruction searches the Source string for the Search string. If the instruction
finds the Search string, the Result shows the starting position of the Search string within
the Source string.
Arithmetic Status Flags: Not affected
Fault Conditions:
Find String
Source ?
??
Search ?
??
Start ?
??
Result ?
??
FIND
Operand Type Format Enter Notes
Source String Tag String to search in String data types are:
·Default STRING data type
·Any new string data type that you create
Search String Tag String to find
Start SINT
INT
DINT
Immediate
Tag
Position in Source to start the
search
Enter a number between 1 and the DATA size of the
Source.
Result SINT
INT
DINT
Tag Tag that stores the starting
position of the string to find
FIND(Source,Search,Start,
Result);
Type Code Cause Recovery Method
4 51 The LEN value of the string tag is greater
than the DATA size of the string tag.
1. Check that no instruction is writing to the LEN member of the string tag.
2. In the LEN value, enter the number of characters that the string contains.
4 56 The Start value is invalid. Check that the Start value is between 1 and the DATA size of the Source.