Loop to continue after a sub job failure

One Star

Loop to continue after a sub job failure

Hi,
I have a package consist of tflowtoIterate and the sub job. There is a onSubJobError connected to tflowtoiterate component to another sub job.
tFlowtoIterate -- > iterate --> Sub job1
|
|
V
OnSubJobError
|
|
V
Sub job2
If the subjob1 fails it triggers the subjob2, but after the subjob2 executed, the job is get exit.
My concern is, after the execution of subjob2, the tFlowtoIterate should continue to its next loop in the package.
Is there any way to achieve this?
One Star

Re: Loop to continue after a sub job failure

Hi
If a subjob gets an error, it will stop the entire job.
Here is a workaround. Create job as seen below.
Child job:
Subjob1
|
OnsubjobError
|
Subjob2
Mainjob:
tFlowtoIterate-->tRunjob(child job)
Do not select "Die on child error" option on tRunjob.
Regards,
Pedro
One Star

Re: Loop to continue after a sub job failure

Hello,
Could you assist me with one more thing here?
As to how to change the exit-code of the main job, if the child job has failed in any loop or error?
i.e how can I know if the child job has failed any time or not, when I have scheduled the job. As, I always get an exit code of 0, even if any time the child job has failed within the loop.
Regards,
Partha
Five Stars

Re: Loop to continue after a sub job failure

tRunJob provides an Return Code, for example: -
((Integer)globalMap.get("tRunJob_1_CHILD_RETURN_CODE"))
If you're running your child Job a number of times and want your Job to exit with non-Zero if one of these iterations fails, then after each iteration, you should test this return code and store it in your own globalMap Object if it is non-zero. Of course, you can only catch one of these values, should your child Job support different return codes.
You can then get you main Job to exist with the child's return code, by setting it in a tDie component.