Zen is shared between all characters when withdrawn, no matter what. For your situation, you just need careful management:
You bought 5000 Zen, and now you have 5000 for both characters. If you withdraw it, you can sell part of it on Character A, AND sell part of it on Character B. You just gotta make sure you withdraw the Dil balance for Character A BEFORE you do the same for Character B.
This way, you get Dilithilum for both characters, but without accidently sending all of it to only one character.
i figured it out, after doing it, you get a withdraw all check box just uncheck it..
also if you do send all zen or dilithium to one char, just put up a bunch at a ridiculous price and then cancel it.. then it will go back in the shared account.