We run all our Optim processes via batch using PR0CMND and ERRORLEVEL is always set and returned. It's an inherent variable, so there is no need for a parameter to receive this. We do assign our own variable to hold the value of ERRORLEVEL once PR0CMND returns control to the batch job and then we evaluate that variable to determine if the step ran OK or if there was a more serious error. Example of this is like so:
set RETCODE=%ERRORLEVEL% if %RETCODE% == some value then etc etc..... Our jobs are all executed via Windows .bat files, so Python may have some different syntax or commands for evaluating the ERRORLEVEL, but it should be there. Hope this helps!
------------------------------
Keith Tidball
Progressive Insurance
------------------------------