P0339 - CKP (crankshaft position) Sensor Circuit Intermittent
P0341 - CMP (camshaft position) Sensor A Circuit Range/Performance
Take a look at the links above. See if you can find a common failure point between the two sensors. For instance, both sensors are grounded through the PCM. If the PCM were to loose its ground, the sensors may drop out. This condition can be quite intermittent. A scan tool with live data monitoring could be used to watch the sensors and see if there are any drop outs during operation.
I would also say that you should test the wiring from both sensors to the appropriate location on the PCM. The wiring diagrams in the links above are from a 2000 and the PCM used in 1997 is different. I'll see if I can find the appropriate diagram for your truck for PCM terminal references.
You can also search for the codes to see what others have come across if you haven't already. Just remember, that's a zero, not an 'O' after the 'P'.