I created some jobs in Datastage and I want to run them in a order like if one job runs successfully then only another job has to run other wise it has to send a mail to the user which job was failed to run. Please help me with this.
Regards,
Bhanu.
Datastage Job Sequence
Moderators: chulett, rschirm, roy
Datastage Job Sequence
Bhanu
1. I usually make all my triggers on execute "OK".
2. In job properties click automatically handle job properties that fail.
3. Add exception handler without any links to it.
4. Add link from exception handler to email notification
5. Add macro for job name to email subject
6. Add job log to notification.
2. In job properties click automatically handle job properties that fail.
3. Add exception handler without any links to it.
4. Add link from exception handler to email notification
5. Add macro for job name to email subject
6. Add job log to notification.
Mamu Kim
Reply
From the Failed Trigger Links of the job activity stages connect to a Sequencer stage with option ANY.
From the Sequencer stage connect to a Use Variable Activity stage. Create a new variable. Put condition from Activity Variable option for abort :
if Job_Activity1.$JobStatus = 3 then Job_Activity1.$JobName else if Job_Activity2.$JobStatus = 3 then Job_Activity2.$JobName else ''
Then connect variable stage to Notification stage and in the subject select the UserVariableActivity variable from the variable stage.
So whichever job fails the Fail link will write the jobname to the variable stage and that will go into the subject of the email.
From the Sequencer stage connect to a Use Variable Activity stage. Create a new variable. Put condition from Activity Variable option for abort :
if Job_Activity1.$JobStatus = 3 then Job_Activity1.$JobName else if Job_Activity2.$JobStatus = 3 then Job_Activity2.$JobName else ''
Then connect variable stage to Notification stage and in the subject select the UserVariableActivity variable from the variable stage.
So whichever job fails the Fail link will write the jobname to the variable stage and that will go into the subject of the email.
Last edited by ssnegi on Sat Apr 19, 2014 7:04 pm, edited 17 times in total.
A nice thing we started to do was an idea that a vendor came up with. They create a done file for every job in the sequence. Each sequence has a subject name. The subject name is a part of the done file name. So to start over you delete all the done files. If you want to skip a step then manually create the done file. If you want to go back a step then manually remove the last done file. So before a job runs it check for the done file. If there then skip running the job else run the job and create the done file if the job was successful. To create a done file then just
echo "" > #jpDoneDir#/#jpSubjectArea#/Step2.done
Turn off restartability in the sequence. Done files will now control all that. Works great.
echo "" > #jpDoneDir#/#jpSubjectArea#/Step2.done
Turn off restartability in the sequence. Done files will now control all that. Works great.
Mamu Kim