My check engine light is on and code P0344 cam positioning sensor. on 2006 Dodge Ram 1500

So the truck starts and runs fine but it will not allow the rpms to go past 2500 it's kinda ackting like it has a rev limiter on it. Is this all related and how do I fix it.

Asked by for the 2006 Dodge Ram 1500
replace cam sensor and clear codes and go from there