How to resubmit a job the number of times based of the completion code returned by the predecessor job.
Sometimes you may want to resubmit a job a certain number of times based on the completion or return code from a preceding job. So if the first job returns a 5, run the second job five times. If the job returns is a 3, run the second job three times, and so on.
This is applicable to all supported platforms.
1. Use global variable and built-in variable WOB._cmpc to capture the exit code and pass the completion code between the jobs.
2. In the job where you need the 'cmpc-value', execute a script at the job run time to assign the exit code to a WOB variable;
WOB.codeToUse = getVar('exitcode');
This way, the WOB.codeToUse variable would be available in the job to be resubmitted.
if (WOB._subcount < WOB.codeToUse)
- The ‘<’ sign is used because the WOB.subcount starts from zero.
- The 'WOB.codeToUse' variable should have the WOB prefix so the Alert can recognize the variable.
- The 'cmpc-value' implies the job's completion code or exit code.
- The 'cmpc-times' implies the number of times based on the completion code.
Built-in Symbolic Variables