/*===============( Binary search at position )===============*/ BiSearchAtPos: Procedure Expose stem. Arg search, atPos, len If DataType( atPos ) <> 'NUM' Then atPos = 1 If DataType( len ) <> 'NUM' Then len = Length( search ) found = 0 /* Index of the found Item */ bottom = 1 top = stem.0 Do While found = 0 & top >= bottom mean = (bottom + top) % 2 Parse Var stem.mean . (atPos) searchValue +(len) . If search = searchValue Then found = mean Else If search < searchValue Then top = mean - 1 Else bottom = mean + 1 End Return found /*** End BiSearchAtPos ***/