Page 1 of 1

Tracking Status of Execute Activity

Posted: Wed Apr 26, 2006 1:10 pm
by avi21st
Hi

I need to trap the status of execute Activity (shell script in my case) in case of failure and then mail out the status.
Using Datastage Job control can we trap the Status of the Shell and the use DSSendMail to mail the log for that execute Activity.

I think DSGetJobInfo would not get me the information. Could if please suggest what to use in this case?

Any help or tips are most welcome.

Posted: Wed Apr 26, 2006 1:15 pm
by DSguru2B
A simple way is to have another shell to check the result of the first shell. If the result is created or valid meaning that it ran, then with conditions you can just mail out the status.

Posted: Wed Apr 26, 2006 1:34 pm
by avi21st
DSguru2B wrote:A simple way is to have another shell to check the result of the first shell. If the result is created or valid meaning that it ran, then with conditions you can just mail out the status.

I need it to be handled together with the datastage jobs....

Say I have the Job Sequencer as

Code: Select all

Shell--yes->DS job--yes-->DS job--yes-->Shell --yes-->Email
  !             !             !            !                  
  !             !             !            !                   
  V             V             V            V                     
  ********** S   E  Q U E N C E********************* -----> Email
So I cannot handle Shell and Datastage error seperately.

I need the same email (Job control routine) to handle both success and failure.

Posted: Wed Apr 26, 2006 2:49 pm
by avi21st
Hi

Another question:

I saw that we have-

#ExecuteActivityName.$CommandName#
#ExecuteActivityName.$CommandOutput#
#ExecuteActivityName.$ReturnValue#


Can we somehow use them in the job control routine to send out success or failure email.

Say I am using the folowing code to get the current job name from where the routine is called:

Code: Select all

* ----------------------------------------------------------------- 
* Get the  Job name from the called Job
* ----------------------------------------------------------------- 

JobName= DSGetJobInfo(DSJ.ME,DSJ.JOBNAME)

then attach the job:

AttachedJob = DSAttachJob(JobName, DSJ.ERRNONE)

and another to get status:

Status= DSGetJobInfo(AttachedJob,DSJ.JOBSTATUS)

Should I get the Execute Activity name if it calls my job control routine to send out the email. Also should all the DSAttachJob and DSGetJobInfo work for Execute Activity??

Please help :cry:

Posted: Wed Apr 26, 2006 5:03 pm
by ray.wurlod
I need the same email (Job control routine) to handle both success and failure.
Write it as a transform function and invoke it through a Routine activity.

Should I get the Execute Activity name if it calls my job control routine to send out the email?
No. Use separate Notification activities, or provide a hard-coded argument to the routine activity.

Also should all the DSAttachJob and DSGetJobInfo work for Execute Activity??
No. These are intrinsic to the product, and can be invoked only from DataStage BASIC (that is, within a Routine). Execute Command activity invokes an operating system command.