to check the engine, right above the water pump on the passenger side, is a flat spot with numbers stamped into it (you may have to do some scraping).
on that pad, the Large numbers will be the casting code, but there will also be a partial vin stamped there, which you can compare with the trucks vin.
remember, if the motor has been machined at some point, there is a chance have ground down that pad, which will make it impossible to verify for sure.
the casting code on the front and rear of the engine will at least tell you if the engine is the correct year.
good luck