Programming instructions
Intermec Fingerprint v7.61 – Programmer’s Reference Manual Ed. 7242
Chapter 2 Program Instructions
SORT
Field of Application
Statement for sorting a one-dimensional array.
Syntax SORT<<nvar>|<svar>>,<nexp
1
>,<nexp
2
>,<nexp
3
>
<<nvar>|<svar>> is the array to be sorted.
<nexp
1
> is the number of the fi rst element.
<nexp
2
> is the number of the last element.
<nexp
3
> > 0: Ascending sorting
< 0: Descending sorting
= 0: Illegal value
In a string array, the value specifi es the position according to
which the array will be sorted.
Remarks
A numeric or string array can be sorted, in its entity or within a specifi ed
range of elements in ASCII value order.
The 4:th parameter (<nexp
3
>) is used differently for numeric and string
arrays. The sign always specifi es ascending or descending order. For numeric
arrays, the value is of no consequence, but for string arrays, the value
specifi es for which character position the elements will be sorted. <nexp
3
>
= 0 results in Error 41, “Parameter out of range.”
Example
One numeric and one string array are sorted in descending order. The
string array is sorted in ascending according to the third character
position in each string:
10 ARRAY% (0) = 1001
20 ARRAY% (1) = 1002
30 ARRAY% (2) = 1003
40 ARRAY% (3) = 1004
50 ARRAY$ (0) = "ALPHA"
60 ARRAY$ (1) = "BETA"
70 ARRAY$ (2) = "GAMMA"
80 ARRAY$ (3) = "DELTA"
90 SORT ARRAY%,0,3,-1
100 SORT ARRAY$,0,3,3
110 FOR I% = 0 TO 3
120 PRINT ARRAY% (I%), ARRAY$ (I%)
130 NEXT
RUN
yields:
1004 DELTA
1003 GAMMA
1002 ALPHA
1001 BETA