2-493
2 Instruction Descriptions
NJ-series Instructions Reference Manual (W502)
Stack and Table Instructions
2
RecSort
When the value of Execute is TRUE, Size elements of InOut[] (a structure array) is sorted. Specifically,
the elements from InOut[0] to InOut[Size
−
1] are sorted. Specifically, the elements from InOut[0] to
InOut[Size
−
1] are sorted. Order specifies the sort order. Details are provided below. One of the mem-
bers to sort in the elements of In[] is passed as an argument to Member.
Always attach the element number to the in-out parameter that is passed to InOut[], e.g., array[3].
The data type of sort order Order is enumerated type _eSORT_ORDER. The meaning of the enumera-
tors are as follows:
The following example is for when Size is UINT#5, Member is 3456 and Order is _Asc.
Function
Enumerator Meaning
_ASC Ascending
_DESC Descending
RecSort_instance(A, abc[0], UINT#5, abc[0].m, _ASC, def, ghi, jkl);
LD ST
abc[0]
UINT#5
_ASC
abc[0]
jkl
ghi
def
abc[0].m
A
RecSort
RecSort_instance
Execute Done
InOut
Size Busy
Member Error
Order
Member = abc[0].m
Member m
Sorted.
0000
3456
0000
Size=UINT#5
0000
2345
0000
0000
1234
0000
0000
3456
0000
0000
1234
0000
InOut[0]=abc[0]
InOut[1]=abc[1]
InOut[2]=abc[2]
InOut[3]=abc[3]
InOut[4]=abc[4]
Order=_ASC
0000
1234
0000
0000
1234
0000
0000
2345
0000
0000
3456
0000
0000
3456
0000
InOut[0]=abc[0]
InOut[1]=abc[1]
InOut[2]=abc[2]
InOut[3]=abc[3]
InOut[4]=abc[4]