Assuming your doing some sort of SHELL statement that runs a program that produces this output. Suggest you try querying the value of @ERROR to see if a meaningfull number if returned, that can be checked with an IF statement.

Try putting this after the SHELL statement and advise:

? @ERROR

-Shawn