2 Instruction Descriptions
2-484
NJ-series Instructions Reference Manual (W502)
The following example is for when Size is UINT#5, Key is INT#1234 and Mode is _LINEAR.
For an ascending binary search, the array elements in the input parameter that is passed to In[] must be
in ascending order before this instruction is executed. Then a binary search is performed by executing
this instruction.
ghi:=RecSearch(abc[0], UINT#5, abc[0].m,
INT#1234, _LINEAR, def, jkl);
LD ST
abc[0]
def def
ghi
jkl
UINT#5
abc[0].m
INT#1234
_LINEAR
RecSearch
EN ENO
In
Size Num
Member
Key
Mode
InOutPos
Out = ghi
InOutPos[0] = def
Num = jkl
Member m
Matches
0000
3456
0000
Size=UINT#5
Key
Mode=_LINEAR
INT#1234
0000
2345
0000
0000
1234
0000
0000
3456
0000
0000
1234
0000
In[0]=abc[0]
In[1]=abc[1]
In[2]=abc[2]
In[3]=abc[3]
In[4]=abc[4]
Member=abc[0].m
TRUE
UINT#2
UINT# 2