Version 8 is, of course, prehistoric.
In version 8 and earlier you would implement this sort of thing via "compile on the fly" (which requires a compiler license).
Something like:
/* q.p
*/
for each {1} no-lock {2}:
display {3}.
end.
Which you then call passing your variable bits as arguments like so:
run q.p "customer" "where customer.state = 'ma'" "name".
This is much cruder than v9+ dynamic queries and the compiler requirement prevents a lot of uses but it might be good enough for whatever it is that you are doing.