Read the input signal of shift position from Subaru Select Monitor.
Does the display show “7” when in “P” range and other than “7” when not in “P” range?
Inspect the inhibitor switch and TCM.