7-96
SORT,DSORT
(2) Several scans are required for sorts performed by the SORT instruction. The number of
scans executed until completion is the value obtained by dividing the maximum number of
times executed until the completion of the sort by the number of data blocks compared at
one execution designated by . (Decimal fractions are rounded up.)When the value of
is increased, the number of scans until completion of the sort is reduced, but the amount of
time per scan is lengthened.
(3) The maximum number of executions until completion of the sort should be calculated
according to the following equation:
The maximum number of executions until completion (n) (n - 1) / 2 [times executed]
When n 10, the number of executions is obtained as 10 (10 - 1) / 2 45 [times executed].
If 2, then the number of scans until the completion of sort is calculated as
45/2 22.5 23 [scans].
(4) The device designated by (the completion device) is turned OFF by the execution of the
SORT instruction, and turned ON when the sort is completed. Because the device
designated by is maintained in the ON state after the completion of the sort, the user
must turn it OFF if required.
(5) The 2 points from the device designated by are used by the system during the execution
of the SORT instruction. These 2 points from the device designated by should therefore
not be used by the user.
Changing these points may cause an error code to be returned (Error code: 4100).
(6) If the value of n is changed during the execution of the SORT instruction, the sort will be
conducted in accordance with the number of sort data blocks after the change.
(7) If the execution command is turned OFF during the execution of the SORT instruction, the
sort is suspended. The sort resumes from the beginning when the execution command is
turned ON again.
(8) To execute another sort operation immediately after the completion of the previous sort, turn
OFF the execution command once, then turn it ON.
DSORT
(1) Sorts (rearranges data) BIN 32-bit data n points from in ascending or descending order.
Sort order is designated by the ON/OFF status of SM703:
• When SM703 is OFF : Ascending order sort
• When SM703 is ON : Descending order sort
S2 S2
Example
S2
D1
D1
D2
D2
S1
Data before sort
When SM703 = OFF
When SM703 = ON
Sort in the ascending order
Sort in the descending orde
r
-124
-1000
500
35000
35000
-124
500
-1000
-1000
500
-124
35000
+
2
+4
+6
S1
S1
S1
S1
+1
,
+3
,
+5
,
+7
,
S1
S1
S1
S1
+
2
+4
+6
S1
S1
S1
S1
+1
,
+3
,
+5
,
+7
,
S1
S1
S1
S1
+
2
+4
+6
S1
S1
S1
S1
+1
,
+3
,
+5
,
+7
,
S1
S1
S1
S1