>Select DISTINCT TIME from RZStop where ALLTRIM(RZStop.RTE_NO) == lcRteNo ...>To optimeze this, you need an index on ALLTRIM(RTE_NO), which is not advicabe, an index key must ALWAYS give a fixed length, which alltrim() does not give! A better solution is an index on ADDBS(RTE_NO,10) (adjust 10 if necessary), and this change in the select:
>Select DISTINCT TIME from RZStop where ADDBS(RTE_NO,10) = lcRteNo ...>You must also change the other alltrim() functions accordingly.