If you would like to react to a ending status the following script can be used in the post process tab of a job.
:SET &RUNNR# = SYS_ACT_ME_NR()
:SET &STATUS# = GET_UC_OBJECT_STATUS(JOBS,&RUNNR#)
:IF &STATUS#=<enter 4 digit return code here. for example 1815>
:SET &ACTOBJ# = ACTIVATE_UC_OBJECT(<example job here>,,,,,,)
If you want to restart the task under this condition you can replace the ACTIVATE_UC_OBJECT with RESTART_UC_OBJECT.
All return codes can be found in the documentation here: