Johnbee58
...using a latch cable pedal as a piano sustain.
With the right technique, this could be made to work after a fashion, but normally you would want something with a momentary non-latching switch. With a latching switch, you'd have to pedal twice for each change in state. And understand that it's the keyboard that actually generates the MIDI message; switch closed causes the keyboard to send CC64 = 127 (down), and switch open sends CC64=0.
So the first thing to do would be to check the Event List in SONAR, and see if the messages are being recorded as expected.