...
DB2 ?SELECT name,agid,agid_name FROM arsag?
DB2 ?UPDATE ARSAGFLD SET MASK=2 WHERE AGID=(application group id AND NAME=?? name of field to change to an index?
...
Wooooooooooww... WARNING...
By doing that, it means you are setting the MASK to 2. But this field contains LOTS of signification. Each bit means something.
So if you put the value 2, it means you are setting all other bit to 0, which could destroy completely your datamodel and even produce some undesirable consequence...
I would propose something like:
DB2 ?UPDATE ARSAGFLD SET MASK=MASK+2 WHERE AGID=(application group id AND NAME=?? name of field to change to an index?
So in that case you are sure that you touch ONLY the bit 2 (of course you need to check before that it was to 0).
You could do it also like that:
DB2 ?UPDATE ARSAGFLD SET MASK=MASK+2 WHERE AGID=(application group id) AND NAME=?? name of field to change to an index? AND BITAND(MASK,2)=0
Cheers,
Alessandro