In reply to dave_59:
Thanks a lot Dave :)
One last question,
foreach(reg_a[,j]) reg_a.sum() with (int'(item[j])) == 1;
In this case, when you do reg_a.sum() with (int’(item[j])) == 1, you mean the value of the packed dimension to be unique or in other words it should not be same as any other element in the array correct?