7 APPLICATION INSTRUCTIONS
7.5 Data Processing Instructions
445
7
• 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 (S2)=2, then the number of scans until the completion of sort is calculated as 45/2=22.5 23 [scans].
• The device designated by (D1) (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 (D1) is maintained in the ON state after the completion
of the sort, the user must turn it OFF if required.
• The 2 points from the device designated by (D2) are used by the system during the execution of the SORT instruction.
These 2 points from the device designated by (D2) should therefore not be used by the user. Changing these points may
cause an error code to be returned (Error code: 4100).
• 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.
• 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.
• To execute another sort operation immediately after the completion of the previous sort, turn OFF the execution command
once, then turn it ON.
■DSORT
• Sorts (rearranges data) BIN 32-bit data n points from (S1) in ascending or descending order. Sort order is designated by the
ON/OFF status of SM703:
• Several scans are required for sorts performed by the DSORT 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 (S2). (Decimal fractions are rounded up.) When the value of (S2) is
increased, the number of scans until completion of the sort is reduced, but the amount of time per scan is lengthened.
• 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 (S2)=2, then the number of scans until the completion of sort is calculated as 45/2=22.5 23 [scans].
• The device designated by (D1) (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 (D1) is maintained in the ON state after the completion
of the sort, the user must turn it OFF if required.
• The 2 points from the device designated by (D2) are used by the system during the execution of a DSORT instruction.
These 2 points from the device designated by (D2) should therefore not be used by the user. Changing these points may
cause an error code to be returned (Error code: 4100).
• 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.
• 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.
• To execute another sort operation immediately after the completion of the previous sort, turn OFF the execution command
once, then turn it ON.
• When SM703 is OFF: Ascending order sort
• When SM703 is ON: Descending order sort
Data before sort
When SM703 = OFF
When SM703 = ON
Sort in the ascending order
Sort in the descending order
-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