724
Table Data Processing Instructions Section 3-17
SRCH(181) searches table data that contains one word in each record. For
searching data that contains more than one word per record, use DIM(631),
SETR(635), GETR(636), FOR(512)–NEXT(513), or BREAK(514) together
with an Index Register (IR).
The status of the Equals Flag can be checked immediately after execution to
determine whether or not there was a match.
Note SRCH(181) can be processed in the background. Refer to the SYSMAC CS/
CJ/NSJ Series PLC Programming Manual (W394) for details.
Related Memory Area
Words
Flags
Precautions If no match is found, the contents of IR00 and DR00 are left unchanged.
If background execution is enabled in the PLC Setup, the PLC memory
address of the first word containing a match will be output to Auxiliary Area
words A595 and A596 instead of IR00.
If background execution is enabled in the PLC Setup and control word C+1 is
set to output the total number of matches to DR00 (C+1 = 8000 hex), the total
number of matches will be output to Auxiliary Area word A597 instead of
DR00.
Examples When CIO 000000 is ON in the following example, SRCH(181) searches the
10-word range beginning at D00100 for words that have the same content as
D00200. The PLC memory address of the first word containing a match is
written to IR00 and the total number of matches is written to DR00.
Name Address Operation
IR00 Output for
Background Execution
A595 and
A596
When an index register is specified as the out-
put for an instruction processed in the back-
ground, A595 and A596 receive the output
instead of IR00.
(A595 contains the rightmost digits, and A596
contains the leftmost digits.)
DR00 Output for
Background Execution
A597 When a data register is specified as the output
for an instruction processed in the background,
A597 receives the output instead of DR00.
Equals Flag for
Background Execution
A59801 This flag is turned ON if matching data is found
for a SRCH(181) instruction executed in the
background.
ER/AER Flag for
Background Execution
A39510 This flag is turned ON if an error or illegal
access occurs during background execution.
Name Label Operation
Error Flag ER ON if the content of C is not within the specified range of
0001 through FFFF.
OFF in all other cases.
Equals Flag = ON if one or more of the words in the search range con-
tain the comparison data.
ON if the Communications Port Enabled Flag for the com-
munications port number specified as the Com Port num-
ber for Background Execution is OFF when background
processing is specified.
OFF in all other cases.