Setting different variables from serial input

How would I accomplish this?

First, your examples leave a lot to be desired. A letter followed by a number is a problem, because you have no idea when the number ends. 2S or 152B means that you know when the number ends, but that makes parsing more difficult.

S2; or B152; also delimits the number, and keeps the identifier up front.

Once you have a complete packet, such as "B152", you can look at the first letter to see where store the value. Then, replace the first letter with a space, and call atoi() on the result, to get an int. Now, you know where to store the int.