I have a '98 VW Beetle with a Engine Check Light fault 0341 or Cam Position sensor problem. I have had this problem for about 40,000 miles and at times have tried to fix it.
In responding to your "how to" request let me first say that the Beetle uses the cam position sensor to fine tune the gasoline mixture and spark to real-life driving conditions. In the event the cam position sensor stops working, the computer control system simply reverts to a built-in database of mixture and spark settings. These are just fine but may result in some increased gasoline consumption.
Now for the fix-it suggestions: a faulty cam position sensor is not very common by what I have read. But the cam position sensor fault can be a result of in improperly tensioned or timed, toothed cam belt. In addition, the cam position sensor fault seems to be commonly caused because of frayed or otherwise faulty wiring from the sensor to its' connection into the wiring harness.
To replace the sensor, you must remove the toothed cam belt (loosen the tensioner and pull the belt off of the cam sprocket) and the cam sprocket. The sensor is located behind the sprocket - it is easily replaced. Althought this may seem daunting, the hard part is relocating the cam sprocket correctly to the cam shaft. You see, there is no key or fixed marks to get it back on correctly. I do recommend that you get a repair book to try the yourself. The VW book is somewhat difficult to use and I have never looked at the Haynes manuals.
Everything that "Wiki User" said is right except for the part about there being no key on the cam sproket. There is a key on the cam sprocket so you cannot put the cam sprocket back onto the camshaft incorrectly.
There IS a problem though, putting the toothed timing belt back onto the camshaft sprocket though, if you haven't first marked it (The camshaft sprocket AND the timing belt) with a dab of something like white-out or silver nail polish, so that you can be sure to get the timing belt back into the EXACT spot it needs to be on the cam sprocket.
When you loosen the timing belt, and remove the sprocket from the camshaft, the camshaft WILL turn a few degrees as the spring loaded lifters work against the lobes of the camshaft. It WILL rest a few degrees off from where it should be, and after replacing the sensor, you WILL have to carefully use a pair of pliers to turn it back to the position it needs to be in, and HOLD IT THERE while you reinstall the cam sprocket.