!**********************************************************************
!* Define Array *
!**********************************************************************
begin-procedure Define-Array
create-array name=ARRdat size=1001 field=ARRkey:char
let #ARR = 0
let #ARR_max = 1000
end-procedure
!**********************************************************************
!* Load Array *
!**********************************************************************
begin-procedure Load-Array
let #ARR = 0
while #ARR < #ARR_max
let #ARRkey = #ARR + 1
let $ARRkey = edit(#ARRkey,'0999')
let ARRdat.ARRkey (#ARR) = $ARRkey
let #ARR = #ARR + 1
end-while
let #ARRb = 1
while #ARRb <= #ARR ! Determine minimum power of 2
let #ARRb = #ARRb * 2 ! greater than entry count
end-while
if #ARRb > 1
let #ARRb = #ARRb / 2 ! Set Binary Search Start Point
end-if
display ' '
display ' Total Entries: ' noline
display #ARR 999
display 'Binary Search Start: ' noline
display #ARRb 999
display ' '
end-procedure
|