Pierre Zippi wrote: > Any ideas why this sort never exits the DO : UNTIL gap=0 loop? > > CLEAR LOCAL > DIM 50 sortedStr$(_maxRowCol) 'only use 50 char str > LOCAL FN AlphaSort > LONG IF multiSort%=0 > FOR col=0 TO gTotalCol-1 'Re-set to original index%(x) order > index%(col)=col > NEXT col > END IF > FOR x=0 TO gTotalCol-1 'assign same values to new array > sortedStr$(x)=COLUMNLABELS$(x) > NEXT x > size=gTotalCol-2 'was size=_numberOfItems-1, but > didn't sort last entry > gap=size > DO > gap=INT(gap.3) 'fp divide > FOR count= 0 TO size-gap 'sort > theItem=count+gap 'get the item to sort out > LONG IF sortedStr$(count+1)>sortedStr$(theItem+1) ' see if it > is larger (add 1 cor col label) > SWAP sortedStr$(count+1),sortedStr$(theItem+1) 'swap if > true(add 1 cor col label) > SWAP index%(count),index%(theItem) 'swap > index (no 1 for reg index) > END IF > NEXT count > UNTIL gap=0 'loop until > END FN gap = int( gap / 1.3 ) 'fp divide Robert P.