MCH1202 is telling you that by subtracting a longer variable size from the shorter variable size the result might be truncated.
I imagine the reason it works in your second example is that you are maxing out to the absolute length of the B value and also A is the same length which sort of “Fakes” the AS/400 into letting it know there’s no loss of data. however if you use a smaller value, less then the full length the AS/400 is trying to let you know you may incure some loss of data during a computation.
In any case, while not always necessary, you might consider using the same field sizes whenever performing mathematical operations. use a temporary work field defined as the same size as your longest field and move the B value into it to avoid this conflict.