Is Size$ a binary inside an string(Example "1101")? If that is the case, then I think that you should do this on line 10: BIT[I]=VAL(SIZE$[I])