To clarify - if I read your post I understand, that you dynamically build the HOSTG members. Not that you want to change the attribute of a job to an existing host group? Because changing the host group using the PUT_ATT in the pre-process won't work, also readable in the online help:
"Host group selection, which includes selection of the
agent for a task, is made before its script is processed. :PUT_ATT can
be used to define a different agent but not a different AgentGroup,"
If you want a fancy solution you might try this:
1. Create a static VARA => SOLUTION.VARA
2. Create the HOSTG objects => DC1.HOSTG and DC2.HOSTG
2. During your decision process put the appropriate HOSTG object name into the vara:
:PUT_VAR SOLUTION.VARA, "MYKEY", "DC1.HOSTG"
3. For the object(s) that run on the dynamic host group, use the following string within the agent attribute:
{SOLUTION.VARA,MYKEY,1}
Let me know if that works for you ;-).