491
INSTR, INSTRP
1
2
3
4
4
6
7
8
7.11
Char
acter
string processing inst
ructions
7.11.1
7
INSTR
, INSTRP
: Character string to be searched or head number of the devices where the character string to be searched is stored (character string)
: Character string in which a search is performed or head number of the devices where the character string is stored (character string)
: Head number of the devices where the result of search will be stored (BIN 16 bits)
n
: Location to start the search (BIN 16 bits)
F
unct
i
on
(1) Searches for the character string data designated by in the area starting from the nth character from the left of the
character string data designated by and stores the result of search at the device designated by .
As the result of search, the location of match, counted in the number of characters from the first character of the
character string data designated by , is stored.
When n 3
(2) If there is no matching character string data, stores "0" at .
Operat
i
on
E
rror
(1) In any of the following cases, an operation error occurs, the error flag (SM0) turns ON, and an error code is stored into
SD0.
7.11.17 INSTR, INSTRP
Character string search
7.11.17
INSTR, INSTRP
Setting
Data
Internal Devices
R, ZR
J \
U \G
Zn
Constants
Other
Bit
Word
Bit
Word
K, H
$
––
––
––
––
––
––
––
––
––
––
––
n
––
––
Error
code
Error details
Q00J/
Q00/
Q01
QnH
QnPH QnPRH
QnU
LCPU
4100
The value of n exceeds the number of characters for .
00
H
(NULL) does not exist within the corresponding device range after
the device specified by and .
n is negative or 0.
––
Process
High
performance
Redundant Universal
LCPU
Bas
i
c
Command
Command
IN
S
T
R
IN
S
T
RP
n
n
S1
S2
D
S1
S2
D
INSTR
INSTRP
S1
S2
D
S1
D2
D
S1
S2
D
S2
Searches from the
3rd character
+1
41
H
(A)
42
H
(B)
43
H
(C)
44
H
(D)
45
H
(E)
46
H
(F)
47
H
(G)
48
H
(H)
49
H
(I)
4A
H
(J)
4B
H
(K)
00
H
+2
+3
+4
+5
"ABCDEFGHIJK"
+1
45
H
(E)
46
H
(F)
47
H
(G)
48
H
(H)
+2
00
H
"EFGH"
5th character from
the first character
5
Stores the position of the
found character, counted
by the number of characters
from the 1st character in
the character string data
designated by .
b15
b8b7
b0
S1
S2
D
b15
b8b7
b0
S2
S2
S2
S2
S2
S1
S1
S2
D
S2
S1
S2