select cls_desc as categoryclassdesc, o.obj_org as organization, o.obj_code as category, o.obj_desc as categorydesc,
	o.obj_class as categoryclass, o.obj_class_org as categoryclsorg, o.obj_manufact as manufacturer
from r5objects o, r5classes c, r5userorganization
WHERE OBJ_OBRTYPE = 'C'
AND ((o.obj_class LIKE COALESCE(<parameter.class>,'%')
AND o.obj_class_org like COALESCE(<parameter.classorg>, '%'))
	OR (COALESCE(null, 'false') != 'true'
		AND o.obj_class = '*'
		AND o.obj_class_org = '*'))
AND (o.obj_class || '#' || o.obj_class_org) IN (c.cls_code || '#' || c.cls_org)
AND cls_rentity = 'OBJ'
AND cls_org = uog_org
AND uog_user = <parameter.r5user>
AND ( cls_org = '*' OR (uog_common = '+' and  cls_code <> '*') OR uog_org = <control.org> )