You can just create a function with inputs i1, j1, k1, i2 , j2, k2 and n to do what you want.
H[n_][i1_, j1_, k1_, i2_, j2_, k2_ ] := If [ i1 + j1 +k1 = n && i2 + j2 +k2, (* Do something *), (* Do something *)]
You can even parametrize the tasks of the conditional statement in the above code.