Brad,
When you say that select takes 37 seconds. Does it take 37 seconds for you to get the entire resultset or until it returns some records to you? A lot of products that allow you to query the database only get so many records at a time, but how long does it take until the last record is fetched is often quite different.
I would think an index on VSADETL table with the columns SBDIV and SBCLS would be beneficial to you. Also, I would change your sql to something more like:
update R35FILES.VCMUDEF
set CCF043 = 'Y'
where CCCUST in (select SBCUST
from VAIMODSDTA.VSADETL
where SBDIV = 23
and SBCLS IN (27,28)
group by SBCUST
having sum(SBPRIC) > 2000)
Another solution without a new index is there must be some key between these two tables that is indexed so you could try something like:
update R35FILES.VCMUDEF a
set CCF043 = 'Y'
where exists (select SBCUST
from VAIMODSDTA.VSADETL b
where a.key = b.key
and SBDIV = 23
and SBCLS IN (27,28)
group by SBCUST
having sum(SBPRIC) > 2000)
I'm not too sure about the group by/having clause in an exists/not exists clause, never tried it before. Good luck.
Dave Nance