Page 1 of 1

Issues regarding Notification Activity

Posted: Sat Apr 22, 2006 9:15 am
by avi21st
Hi

I have two Notification Activity in my Job sequencer- one which send mail in case of Success and one in case of Failure to different email address.

I have the option to add the job status in th email enabled:

In case of success of the Job sequencer run, I am getting this message

Code: Select all

Description : Loads the Registry Infile >> Stg_Registry table >> Tmp_Registry table >> Registry

Success: WL_SeqRegistry ran successfully.


**************************************************
STATUS REPORT FOR JOB: WL_InpToStgRegistry

Generated: 2006-04-21 17:33:56
  Job start time=2006-04-21 17:33:55
  Job end time=2006-04-21 17:33:56

  Job elapsed time=00:00:01
  Job status=1 (Finished OK)
     Stage: RegistryFrmt_Xfm, 101 rows input

     Stage start time=2006-04-21 17:33:56, end time=2006-04-21 17:33:56, elapsed=00:00:00

        Link: In_File_Registry, 101 rows
        Link: Out_Xfm_RegistryFrmt, 101 rows
        Link: Out_Xfm_Err_RegistryFmt, 0 rows

**************************************************
STATUS REPORT FOR JOB: WL_StgToTmpRegistry

Generated: 2006-04-21 17:33:57
  Job start time=2006-04-21 17:33:56
  Job end time=2006-04-21 17:33:57

  Job elapsed time=00:00:01
  Job status=1 (Finished OK)
     Stage: RegistryFrmt_Xfm, 101 rows input

     Stage start time=2006-04-21 17:33:56, end time=2006-04-21 17:33:56, elapsed=00:00:00

        Link: In_Table_StgRegistry, 101 rows
        Link: Out_Xfm_RegistryFrmt, 101 rows
        Link: Out_Xfm_ErrRegistryFmt, 0 rows
Question 1:

But I have two Execute Routine Activity(running a shell script) in the Sequencer along with two Job activity. Why I am not getting the status report of those two Execute Routine Activity in the above email. How can I have the status report of those two in the email notification?

Question 2:

While in failure I am getting a mail with only the text- tough I have the option to add the Log in the body of the mail. I want the status of the job which failed and the email should tell me which job failed. The Error message was like:

Code: Select all

************WL_SeqLoadRegistry Failed***************

Description : Loads the Registry Infile >> Stg_Registry table >> Tmp_Registry table >> Registry

Error: WL_SeqRegistry failed to run.
Question 3:

I also wanted to add in the subject the name of the job that failed in case of failure email. Is it possible? DO you think I should write my own routine for this. If so could you give some example of that.

Thanks for your help in advance. :D

Posted: Sat Apr 22, 2006 5:24 pm
by ray.wurlod
1. Because it's a JOB status report.

2. Alas, that's how it works. Submit an enhancement request. If the job fails, then one can have no confidence about stage start and end times, link row counts, etc., so they are simply not reported.

3. Any such change to default behaviour is a DIY exercise. Suitable routines have been posted in this forum, a Search ought to find them. Include "send" and "mail" (and possibly "routine") in your search criteria and specify "all terms".

Posted: Wed Apr 26, 2006 8:40 am
by avi21st
Hi

I am trying to develop the Job control routine to track the status from the calling job and send a mail. I am trying to get the log details by the following code. Is it the correct way of trapping the status from a Datastage job.

I have never used Job control before. Sorry if there are any silly errors

If not-Please let me know how to trap the status of a job

Code: Select all

* ----------------------------------------------------------------- 
* Get the log details from the called Job
* ----------------------------------------------------------------- 

JobName= DSGetJobInfo(DSJ.ME,DSJ.JOBNAME)
Status= DSGetJobInfo(DSJ.ME,DSJ.JOBSTATUS)
Begin case
      case Status=DSJS.VALOK 
           JobStatus="Job finished a validation run with no warnings."
      case Status=DSJS.VALWARN 
           JobStatus="Job finished a validation run with warnings." 
      case Status=DSJS.RUNWARN 
           JobStatus="Job finished a normal run with warnings."
      case Status=DSJS.STOPPED 
           JobStatus="Job was stopped by operator."
      case Status=DSJS.VALFAILED 
           JobStatus="Job failed a validation run."
End Case

Posted: Wed Apr 26, 2006 3:49 pm
by kduke
The status of DSJ.ME should always be "Running". If you look at job control generated for sequences. Then you can see how to get job status. You may need to leave off the job run and the wait for job routine calls but you need to attach to a job first. There is lots of code posted by me and others which explains how to do this.

Posted: Wed Apr 26, 2006 4:19 pm
by avi21st
Hi

When I am running the Job control routine to test the Job control Routine to send mail I am getting the following error:

Code: Select all

CopyOfWL_SeqLoadRegistry_test_mail..JobControl (DSSendMail): The following tokens in the 'dssendmail_template.txt' file have not been set in the call to DSSendMail: %from%,%to%

CopyOfWL_SeqLoadRegistry_test_mail..JobControl (@Success_Email): Routine DSU.JobStatusSendMail did not finish OK, return code = '1'

Can you suggest what is the problem in the routine- or Do I need to set some internal file for that-If so how to do that?


Please help.

Thanks

Posted: Wed Apr 26, 2006 4:36 pm
by avi21st
avi21st wrote:Hi

When I am running the Job control routine to test the Job control Routine to send mail I am getting the following error:

Code: Select all

CopyOfWL_SeqLoadRegistry_test_mail..JobControl (DSSendMail): The following tokens in the 'dssendmail_template.txt' file have not been set in the call to DSSendMail: %from%,%to%

CopyOfWL_SeqLoadRegistry_test_mail..JobControl (@Success_Email): Routine DSU.JobStatusSendMail did not finish OK, return code = '1'

Can you suggest what is the problem in the routine- or Do I need to set some internal file for that-If so how to do that?


Please help.

Thanks
I saw in JobCONTROL.H in my project diretcory the DSSendMail to be set as:

Code: Select all

Deffun DSSendMail(Parameters)
should I have to reset it?

As the above error message is saying: %from%,%to%

Please mail: I am in a fix.

Posted: Wed Apr 26, 2006 5:19 pm
by ray.wurlod
There is an example routine that shows how DSSendMail should be used. It is in the Routines branch, possibly under Examples (I don't have access to DataStage at the moment).

Examine this code. DSSendMail() requires, as its single argument, a delimited string containing all of the values that will replace tokens in the BAT file.

JOBCONTROL.H is automatically included in job control routines; you do not need to "reset" it (whatever you mean by that). To use DSSendMail from a transform function or a before/after subroutine then you would need to include this header file.

Posted: Wed Apr 26, 2006 9:07 pm
by chulett
DSSendMailTester. Routines/Built-In/Utilities. :wink: