Hi, my name is Ed. Welcome to JustAnswer!.
Ooooo.... that sounds like the PCM (engine controller) isn't awake when you have your problem-event. While JTEC engine controllers usually have their problems after being heated, temperature does play a role in most of these units and their failures.
To begin with, this particular year of truck DOES support a code-read feature that allows you to pull trouble codes without a scan tool, using this little key dance...
Hop in the truck and close the door. Roll the key from off to on (LOCK TO RUN) three times, leaving it in the ON position after the last cycle. Sit back and watch the odometer for a switch from miles to codes.
A pause will be in order, followed by any codes stored in PCM memory. At the end of the process, you should ALWAYS see a "P-done" message, whether any codes were shown or not. This tells you that YES, the process had initiated and completed and that no codes were present. Having a code pop up is, of course, the preferred result and it will be in "P-code" format (P followed by four number digits).
If the PCM is losing consciousness between key cycles, no codes will be present, which does allow us a small luxury of testing. By introducing a code of our own choosing into PCM memory... the waiting for it to have its little fit... and then checking to see if it's still there... we can effectively tell if the PCM has been losing memory. This should never happen if battery
voltage remains high (above 10.5v when cranking).
So do a key dance to see if you have any codes stored and shoot me the numbers. If nothing shows up. just pull a connector off from any important-looking sensor under the hood with the key on (engine off) and check to see that the CE light is now on. Do the key dance to retrieve the code and wait for the next time the engine refuses to start... then does.
Recheck codes. If the code is gone, you almost certainly have a PCM issue. We'll go into more depth when that happens.
Talk in a bit,