Creating a host variable of the where in statement on the fly is possible, but it is best implemented with dynamic SQL.
Here's what the psuedo-code would look like:
DECLARE C1 CURSOR FOR S1 ;
SET W-Excl = '(00,27');
SET mystmt = 'SELECT R040_PRD_GRP_ROLLUP,R040_PRODUCT_GROUP,R040_PRD_GRP_DESC,
COUNT (*) from CSSDM01040 Where R040_PRD_GRP_ROLLUP Not In ' || W-excl || ' group by
R040_PRD_GRP_ROLLUP,R040_PRODUCT_GROUP,R040_PRD_GRP_DESC'
PREPARE S1 FROM mystmt ;
OPEN C1 ;
FETCH C1 INTO :rollupvar, :groupvar, :descvar, :countvar ;
....
|