Strange behavior using DSSendMail in Basic Transformer

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
gsherry1
Charter Member
Charter Member
Posts: 173
Joined: Fri Jun 17, 2005 8:31 am
Location: Canada

Strange behavior using DSSendMail in Basic Transformer

Post by gsherry1 »

Hello Forum,

I am running a Parallel job that contains a Basic Transformer. This basic transformer is calling DSSendMail.

I have observed several strange situations when using this as a multi-Instance job:

1. The emails sometimes fail to be sent out. A network error appears consistent with the send mail routine not being able to connect to the smtp server. When this error occurs, it consistently re-occurs when rerun until the job is run without invocation Id. Error Message Below:
SMTPMail Looking up server...
SMTPMail Opening connection to ...
SMTPMail Unknown failure!
SMTPMail Error in trying to connect
SMTPMail Network error 10061
2. The body of the email received contains a mixture of content from the current execution and the last execution of the job without invocation Id. Specifically, the email body portions derived from job parameters contain values from the execution of the last time the job was run without providing an invocation Id, and the portions of the body derived from stage variables are from the current execution. Even when I check the datastage job log for the current execution I can see that the job parameters are being passed correctly, but they are different from the values received in email.

I found the above errors very odd, and have not been able to repeat them in some projects.

I have a default send mail template.
I have checked into the DSSendmail documentation and it seems that both the .bat and the .tmp generated are using the job name without invocation Id included. The %file% token manipulation doesn't seem to affect this naming.

Questions:
1. Anybody know anyway to change the naming of the .bat and .tmp files to help eliminate one possible source of contention?
2. Any other ideas to help explain the anomalies above?

Thanks,

Greg
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post by roy »

Hi,
Can you concider a work-around like storing all Emails in a table
and having a periodical process go over it and send the emails?
(you can have a DS job that rund every hour,30 minutes or any other interval you need and send the enails)
IHTH,
Roy R.
Time is money but when you don't have money time is all you can afford.

Search before posting:)

Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Image
gsherry1
Charter Member
Charter Member
Posts: 173
Joined: Fri Jun 17, 2005 8:31 am
Location: Canada

Post by gsherry1 »

roy wrote:Hi,
Can you concider a work-around like storing all Emails in a table
and having a periodical process go over it and send the emails?
(you can have a DS job that rund every hour,30 minutes or any other interval you need and send the enails)
IHTH,
Thanks for your response. That solution would achieve serialization of the email functionality. Unfortunately I have explicit requirements for a one job solution.

- Greg
gsherry1
Charter Member
Charter Member
Posts: 173
Joined: Fri Jun 17, 2005 8:31 am
Location: Canada

Re: Strange behavior using DSSendMail in Basic Transformer

Post by gsherry1 »

Update:

It appears that the Basic Transformer does not access job parameters reliably when in a multi-instance job. In some cases if the job had not been run yet without an invocation id, all parameter references from the job with invocation-id are assigned empty string.

In my particular case I was using 5 parameters (including smtp server name) in building and sending an email within the basic transformer. This resulted in either no email being sent out because server was empty string, or email sending with details containing parameter information from older execution of job without invocation id.

I was running the basic transformer in sequential mode with a 'Don't Combine' setting.

I worked around this by writing parameters needed to new columns in an upstream non-basic transformer stage, and referencing the columns within the basic transformer rather than job parameters.

This has solved both of the errors I had been receiving. However, in investigating, it appears that the .tmp and .bat DSSendmail temporary files could potentially cause issues. In reading the sendmail template it appears that the unix setup does not write to temporary file. Is it possible to adjust the windows email executable to accept embedded inline input as in the unix example (ie '<<')?

Thanks,

Greg
Post Reply