You can use the MONMSG command in the CL program to specifically monitor for the errors your CL is getting which you can then deal with the error gracefully. You can also monitor for error messages globally by having the MONMSG command as the first command in the CL program after PGM and declares.
A good simple explanation of how to use error handling in CL can be found at
http://www.400school.com/artmsg.htm