Controlling outputs by setting bits

Your question is not really clear.
You probably need a mask as a filter.

byte mask = 0b111111011;
port = mask & controlsignal;