Basicly a Shaft Encoder will send out 2 different pulse streams. The A pulse is first (if rotated the proper direction) then the B pulse is next 90 deg. out of phase with A.
So if the controller sees the A pulse then the B pulse it knows that the Encoder is rotating in its forward direction. If it sees B then A the controller knows the Encoder is rotating in reverse direction.
The Z signal is not a output in all Encoders. In my industry we will it is normally used for a "Pulse Verification" check. The Z input is normally connected to a Internal switch on the Encoder that will close once per revolution of the Encoder Disk. So if your Encoder is designed to give you 100 Pulses per Revolution. If you use the Z input and if everything is working correct you will see 100 pulses in the HSC Accum register then it will reset and count up to 100 again. By looking at how the Accum counts up to 100 over and over again (repeats) you can say that your Encoder and system is working correctly.
Again that is how we use the Z input but Depending on how you program the HSC it can be used differently. You could use it to reset the HSC at the end of a part run or a manual reset or ??. The manual explains a lot more about how to use the Z input. I am sure there are a lot more people here on the site that could explain how they use the Z input.
Hope this helps.