Just for case, that anybody will need this feature in future:
The flag bit can be easily set by:
where i is status word and a is bit, which has to be set
Note that 0 is first bit, 1 is second bit etc.
Bit can be cleared by:
i=Bit.And(i,Power(2,b)-1-Power(2,a))
for b bit long status word.
Note that b can be higher than length of word, but if it is lower, then all higher bits will be cleared.
Bit can be read by:
flagbit=Bit.And(i,Power(2,a))
This will return 2^a if bit is set. If this is not acceptable add following if
If flagbit>0 Then flagbit=1
so the code will look
flagbit=Bit.And(i,Power(2,a))
If flagbit>0 Then flagbit=1