I am using a Roland XP80 keyboard and find that at times, the pedal makes no difference. At other times the notes sustain continually. I have an FS-300 pedal that was recommended for use on the Roland keyboard which has the polarity switch, but even when this is changed the problem continues.
Here is a troubleshooting guide for your sustain pedal:
Some keyboards will read the "polarity" of the sustain pedal when they are first turned on. If you have your foot on the pedal when you turn on the keyboard it will sustain all notes until you press the pedal (the pedal works in reverse). To fix this, simply turn off the keyboard and turn it back on making sure you don't have your foot on the pedal.
Another potential problem is that sometimes a keyboard will behave strangely when changing sounds while you have some keys depressed. My keyboard will sometimes leave a note or two on when I change sounds like this. My keyboard has a "panic button" which shuts off all notes. For yours you may need to turn it off to fix this type of problem.
Doesn't sustain at all
If the sustain pedal works with certain sounds and not with others, it is probable that the sound is not programmed to use the sustain pedal. In this case you should be able to program the sound to use the sustain pedal.
If the sustain pedal only works intermittently on the same sound, the problem could be either with the sustain pedal itself (most likely in the cable) or with the connector or electronics in the keyboard. The easiest way to test this is to plug in a known good sustain pedal and see if it fixes the problem. If not, the problem is probably in the keyboard.
If you find that the problem is with the sustain pedal itself, you can easily replace the cable with an inexpensive instrument cable (some soldering skills may be required).