Jason, it is difficult for me to understand what your wanting, if you could be more clear in a step by step maner with example, then it would be easier to help.
Here is some VB code based on my current understanding of what you want.
Your Z axis: first off, you could use just the "Dir" part of you Z axis if you wanted, (i.e. the direction component pin of you z axis under motor outputs), in its normal state, lets call it Positive Z (any value will do). The direction pin is at a zero state, which in turn doesnt activate you air solinoid and normal pressure and normal state of the solidnoid keeps the axis pulled up (away from the material).
Then when your program spits out a Negative Z, the "Dir" pin goes high (+5v), this in turn activates your solinoid that drives the axis down into the material, you would probably have to put some kind of mechanical stop so it would only go so far down. The Step and Direction pins on the Z axis already exist, so you could just use the Direction pin.
The other VB route(s):
You could make Two custom Macros, one for "Up" and one for "down" you would have to hand code or Wizard code them in your program
They would BOTH activate or deactivate the same output pin, for example output1
'M40.m1s 'Axis Up state
ActivateSignal(OUTPUT1) 'This would change the state of output 1 on what ever pin you assign, to active high or low
'M41.m1s 'Axis Down state
DeActivateSignal(OUTPUT1) 'this would do the oposite of M40.
Solution 2: Using the Macro pump to watch the state of "Z" this is based off what you posted.
'Macropump.m1s
x=GetOEMDRO(802)
If X<=-50 Then
DeActivateSignal(OUTPUT1)
Else
ActivateSignal(OUTPUT1)
End If
'Let me know how that works out for you, and what you used.
'Scott