using parameters within an e-mail test message
Moderators: chulett, rschirm, roy
using parameters within an e-mail test message
Using Windows Servers, and DataStage version 7.1
We are using parameters to change things like dates and such throughout our jobs. The one place we're having a problem getting the parameter to work is within the e-mail notification stage we use within DataStage Sequencer jobs. We have some e-mail notifications that go out, and these notifications include the dates that we change with our parameters. Is there a way to use the parameters within the "e-mail body" itself?
We are using parameters to change things like dates and such throughout our jobs. The one place we're having a problem getting the parameter to work is within the e-mail notification stage we use within DataStage Sequencer jobs. We have some e-mail notifications that go out, and these notifications include the dates that we change with our parameters. Is there a way to use the parameters within the "e-mail body" itself?
Eric
-
- Premium Member
- Posts: 503
- Joined: Wed Jun 29, 2005 8:14 am
Re: using parameters within an e-mail test message
Yeah , I have the same problem , The DSSENDMAIL doesn't support to attach parameters in it.
I dont know wht can be the workout.
I dont know wht can be the workout.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Hi,
I usually use a routine or a basic job control for notification activities even in 7.5 where you can use parameters simply since usually you need more then just mail notifications.
This way your not limited and any further activity is added effortlessly.
IHTH,
I usually use a routine or a basic job control for notification activities even in 7.5 where you can use parameters simply since usually you need more then just mail notifications.
This way your not limited and any further activity is added effortlessly.
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
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
Here is a routine which can be used in a routine activity which can be sent parameters. I will add this to my tips page soon.
Code: Select all
* -----------------------------------------------------------------
* EtlSendMail(EmailTo, EmailFrom, EmailServer, EmailSubject, EmailMsg)
* -----------------------------------------------------------------
* Arguments:
* 1. EmailTo
* 2. EmailFrom
* 3. EmailServer
* 4. EmailSubject
* 5. EmailMsg
* -----------------------------------------------------------------
* Decription: Email msg to someone.
* -----------------------------------------------------------------
* Written by: Kim Duke
* -----------------------------------------------------------------
* Notes:
* -----------------------------------------------------------------
$INCLUDE DSINCLUDE JOBCONTROL.H
Ans = @TRUE
RoutineName = "EtlSendMail"
ThisDay = convert('-','',oconv(@DATE, "D4-YMD[4,2,2]"))
ThisTime = convert('-','',oconv(@TIME, "MTHS"))
CrLf = Char(13):Char(10)
Host = upcase(DSHostName)
ProjectType = "DEV"
Begin case
case Host = "DSDEV"
ProjectType = "DEV"
case Host = "DSTEST"
ProjectType = "TEST"
case Host = "DSPROD"
ProjectType = "PROD"
end case
NoArgs = 5
for i = 1 to NoArgs
* -----------------------------------------------------------------
* fix defaults
* -----------------------------------------------------------------
begin case
case i = 1
if EmailTo = "" then
EmailToX = "DSX@hotmail.com"
end else
EmailToX = EmailTo
end
if ProjectType = "DEV" or ProjectType = "TEST" then
EmailToX = "DSX@hotmail.com"
end
tmp = EmailToX
gosub DelOutCrLf
case i = 2
if EmailFrom = "" then
EmailFromX = "DSX@hotmail.com"
end else
EmailFromX = EmailFrom
end
if ProjectType = "DEV" or ProjectType = "TEST" then
EmailFromX = "DSX@hotmail.com"
end
tmp = EmailFromX
gosub DelOutCrLf
case i = 3
if EmailServer = "" then
EmailServerX = "MailServer"
end else
EmailServerX = EmailServer
end
tmp = EmailServerX
gosub DelOutCrLf
case i = 4
if EmailSubject = "" then
EmailSubjectX = "Message from: ": ProjectType :" ": DSJobName :" on ": ThisDay :" ": ThisTime
end else
if ProjectType = "PROD" then
EmailSubjectX = EmailSubject
end else
EmailSubjectX = ProjectType :" Job: ": DSJobName :" ": EmailSubject
end
end
tmp = EmailSubjectX
gosub DelOutCrLf
case i = 5
if EmailMsg = "" then
EmailMsgX = ""
EmailMsgX := "Server: ": Host : CrLf
EmailMsgX := "Project: ": @WHO : CrLf
EmailMsgX := "Job: ": DSJobName : CrLf
EmailMsgX := "User: ": @LOGNAME : CrLf
EmailMsgX := "Date: ": ThisDay : CrLf
EmailMsgX := "Time: ": ThisTime : CrLf
EmailMsgX := "EmailServer: ": EmailServerX : CrLf
EmailMsgX := "EmailFrom: ": EmailFromX : CrLf
EmailMsgX := "EmailTo: ": EmailFromX : CrLf
end else
EmailMsgX = EmailMsg
end
tmp = EmailMsgX
gosub ChangeOutCrLf
end case
* -----------------------------------------------------------------
* gosub forced to retunr to here
* -----------------------------------------------------------------
ReturnHere:
* -----------------------------------------------------------------
* fix CrLf turn into \n
* -----------------------------------------------------------------
begin case
case i = 1
EmailToX = tmp
case i = 2
EmailFromX = tmp
case i = 3
EmailServerX = tmp
case i = 4
EmailSubjectX = tmp
case i = 5
EmailMsgX = tmp
end case
next i
* -----------------------------------------------------------------
* test data
* -----------------------------------------------------------------
DSSendMailString = "To:": EmailToX : "\n"
DSSendMailString := "From:": EmailFromX : "\n"
DSSendMailString := "Subject:": EmailSubjectX : "\n"
DSSendMailString := "Server:": EmailServerX : "\n"
DSSendMailString := "Body:": EmailMsgX : "\n"
Call DSLogInfo(DSSendMailString, DSJobName)
Call DSSendMail("", DSSendMailString)
goto TheEnd
* -----------------------------------------------------------------
* del CrLf
* -----------------------------------------------------------------
DelOutCrLf:
tmp = change(tmp, CrLf, ";")
tmp = change(tmp, Char(13), ";")
tmp = change(tmp, Char(10), ";")
tmp = change(tmp, @FM, ";")
tmp = change(tmp, @VM, " ")
tmp = change(tmp, @SVM, " ")
tmp = change(tmp, @TM, " ")
return to ReturnHere
* -----------------------------------------------------------------
* fix CrLf turn into \n
* -----------------------------------------------------------------
ChangeOutCrLf:
tmp = change(tmp, CrLf, "\n")
tmp = change(tmp, Char(13), "\n")
tmp = change(tmp, Char(10), "\n")
tmp = change(tmp, @FM, "\n")
tmp = change(tmp, @VM, " ")
tmp = change(tmp, @SVM, " ")
tmp = change(tmp, @TM, " ")
return to ReturnHere
* -----------------------------------------------------------------
* end of routine
* -----------------------------------------------------------------
TheEnd:
Mamu Kim
Re: using parameters within an e-mail test message
You can use parameters with DSSENDMAIL in 7.1 version , for example in the body you can write :DeepakCorning wrote:Yeah , I have the same problem , The DSSENDMAIL doesn't support to attach parameters in it.
I dont know wht can be the workout.
"Rejects in file ": SrcDir:FileName:"."
or in the Smtp Server Mail block :
"":SmtpServer:""
It's the same syntax than in job control (Basic Universe)
But I have one problem, when I import my jobs in the 7.5 version, the DSSENDMAIL doesn't work anymore... and I don't want to modify all my jobs !!!!
Does someone have any idea or patch !!
I think I'll have to ask the Ascential support... Help please!
Hello,chulett wrote:What about 'the DSSENDMAIL' doesn't work? You really should start a new post rather than jump on the end of an old one so we have some clue what your specs are. What operating system?
I have started a new post 'DSSENDMAIL upgrade 7.1 to 7.5 ' like you said. Have you got some solutions ?
Thanks a lot.