SQL Index order and performance based on cardinality and data
If ID1 is more selective than ID2, then construct your index over B with (ID1, ID2, Type_Code) , and make sure there is an index over A by (ID1, ID2).

If ID2 is more selective than ID1, then construct your index over B with (ID2, ID1, Type_Code) , and make sure there is an index over A by (ID2, ID1).

If you are using DB2 for i, then you might also try an Encoded Vector Index [EVI] over B on (Type_Code), in combination with an index by (ID1, ID2) [or the reverse order, as above].  However, the EVI seems unlikely to help in this case.