A program to sort numbers




This program will sort numbers based on their values. Usually SORT will sort not based on the value of the numbers

PROGRAM TEST.SORT
$INCLUDE T24.BP I_COMMON
$INCLUDE T24.BP I_EQUATE

Y.ARR1 = 1:FM:4:FM:2:FM:8:FM:6:FM:3:FM:13
Y.ARR2 = '1':FM:'4':FM:'2':FM:'8':FM:'6':FM:'3':FM:'13'
Y.CNT = DCOUNT(Y.ARR2, FM)
FOR I = 1 TO Y.CNT
Y.SORT.ITEM = MAXIMUM(Y.ARR2)
Y.SORT.ARR := FM:Y.SORT.ITEM
LOCATE Y.SORT.ITEM IN Y.ARR2 SETTING Y.ITEM.POS THEN
DEL Y.ARR2<Y.ITEM.POS>
END
NEXT I
DEL Y.SORT.ARR<1>
CRT Y.SORT.ARR

STOP

Comments

Popular posts from this blog

Current Variables in T24

All accounting entries of an T24 account

SQL queries in JBase