select 
s.sto_part as partcode,
p.par_desc as partdescription,
s.sto_part_org as partorganization,
cast(CASE p.par_byasset WHEN '+' THEN -1 ELSE 0 END as varchar(4)) as trackbyasset
FROM r5parts p, r5userorganization u,r5stock s WHERE 
 p.par_org = u.uog_org AND       
IFNULL(p.par_notused, '-') <> '+'  AND p.par_code <> '*'  AND       
u.uog_user =<parameter.r5user>  AND ( u.uog_common = '+' or u.uog_org = <control.org> ) 
AND s.sto_part = p.par_code AND s.sto_part_org = p.par_org AND       
s.sto_store = <store_code>