Magnum Neutral Safety Switch, effect idle? and wiring?

As TT5.9mag said, the center pin should be grounded in park and neutral by the switch. This provides ground for the starter relay but the PCM also monitors that wire so it knows the status. The code is likely setting because the PCM sees startup and drive cycles without ever seeing that wire changing status.
If I am seeing this correctly, the wire should come from pin 2 of the park neutral switch, splice off at S127 and to both terminal 85 of starter relay in the PDC and to pin 6 in connector 1 of the PCM.

Note that I am using a 1999 wiring diagram, so it could be different than your 1997, but so far everything I have compared for engine and transmission has always lined up the same.

If you had a manual transmission PCM, or reprogram your PCM as a manual transmission, it will ignore this circuit and code.