I agree with Bob that your question could use some refinement, but I
think I know what you're getting at, so I'll take a shot.
I don't think you can do exactly what you want, but you may come
close. Let M be a sufficiently large positive constant and epsilon a
sufficiently small (but strictly positive) constant, and let Y (a
variable) be the output of your first IF. Introduce a new binary
variable Z together with the following constraints:
(1) epsilon*Z <= A <= M*Z
(2) B - M*Z <= Y <= B + M*Z
(3) -M*(1-Z) <= Y <= M*(1-Z).
A <= 0 forces Z = 0 in the left part of (1), which forces Y = B in (2)
and makes (3) vacuous. A >= epsilon forces Z = 1 in the right side of
(1), which forces Y = 0 in (3) and makes (2) vacuous. Besides
introducing a binary variable, there is one catch: 0 < A < epsilon has
been excised from the feasible region. So this won't work if
arbitrarily small but positive values of A are legitimate contenders
for an optimal solution.
Incidentally, I used the same M in every constraint because I'm too
lazy to type subscripts, but you can (and probably should) use a
distinct M (the tightest value you can find that is guaranteed not to
cut off an optimal solution) in each constraint.
/Paul