using parameters within an e-mail test message

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
EJRoufs
Participant
Posts: 73
Joined: Tue Aug 19, 2003 2:12 pm
Location: USA

using parameters within an e-mail test message

Post by EJRoufs »

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?
Eric
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Only by writing your own email handling routine, for some silly reason the stage doesn't support this functionality.
-craig

"You can never have too many knives" -- Logan Nine Fingers
DeepakCorning
Premium Member
Premium Member
Posts: 503
Joined: Wed Jun 29, 2005 8:14 am

Re: using parameters within an e-mail test message

Post by DeepakCorning »

Yeah , I have the same problem , The DSSENDMAIL doesn't support to attach parameters in it.

I dont know wht can be the workout.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

It's better in version 7.5.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
EJRoufs
Participant
Posts: 73
Joined: Tue Aug 19, 2003 2:12 pm
Location: USA

Post by EJRoufs »

ray.wurlod wrote:It's better in version 7.5.

So when we upgrade to 7.5 in a few months here, I can use the parameters within then?
Eric
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

No, but you can do attachments. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post by roy »

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,
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
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

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
MTCHONG
Participant
Posts: 5
Joined: Tue Dec 06, 2005 1:14 pm

Re: using parameters within an e-mail test message

Post by MTCHONG »

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.
You can use parameters with DSSENDMAIL in 7.1 version , for example in the body you can write :
"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!
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

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?
-craig

"You can never have too many knives" -- Logan Nine Fingers
MTCHONG
Participant
Posts: 5
Joined: Tue Dec 06, 2005 1:14 pm

Post by MTCHONG »

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?
Hello,
I have started a new post 'DSSENDMAIL upgrade 7.1 to 7.5 ' like you said. Have you got some solutions ?
Thanks a lot.
Post Reply