Passing Activity Variable value as an Email Subject

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
SURA
Premium Member
Premium Member
Posts: 1229
Joined: Sat Jul 14, 2007 5:16 am
Location: Sydney

Passing Activity Variable value as an Email Subject

Post by SURA »

Hi there

I created a Sequence to backup individual jobs. All fine expect email notification. All i am trying to do is, in the email subject it trying the pass the number of job (counts) to export. But for some reason i am not able to make it.

Code: Select all

Total Number of Jobs : #Getcount.$CommandOutput# 

In here GetCount is the Command Activity stage placed before the mail. 
Job aborted with the below error

Code: Select all

Export_Individual_DSJob_1..JobControl (DSSendMail): Parameter 4 ('') does not start with a keyword
If i pass any other Parameter then its fine!!

Let me know how to handle it?
Thanks
Ram
----------------------------------
Revealing your ignorance is fine, because you get a chance to learn.
SURA
Premium Member
Premium Member
Posts: 1229
Joined: Sat Jul 14, 2007 5:16 am
Location: Sydney

Re: Passing Activity Variable value as an Email Subject

Post by SURA »

Fails to add one more point, I tried like below too.

Code: Select all

Trim(#Getcount.$CommandOutput#,@FM,"A") 
and getting the below error.

Export_Individual_DSJob_1..JobControl (DSSendMail): Parameter 4 (',@FM,"A") ') does not start with a keyword

Output of the GetCount is

Code: Select all

Export_Individual_DSJob_1..JobControl (@Getcount): Executed: cat  xxxxxxxxxxDS_JOB_NAMES.txt | wc -l
Reply=0
Output from command ====>
      2 
Thanks
Ram
----------------------------------
Revealing your ignorance is fine, because you get a chance to learn.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

What happens if you try "FIELD(#Getcount.$CommandOutput#,@FM,1)" (or the short form "#Getcount.$CommandOutput#<1>")? I hadn't thought of using the TRIM() function the way you didn, I usually use "CONVERT(@FM,'',#Getcount.$CommandOutput#) to remove all field marks. If the error persists, then try to print out the command line after removing the field marks to see what other control characters might still be in the line.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Clearly you did not build your expression using the Expression Editor.

Had you done so you would have learned that activity variable references in expressions do not require surrounding sharp signs.

If it's only the integer portion you require, you could also use

Code: Select all

Oconv(Getcount.$CommandOutput,"MCN")
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

I missed that part even though I cross-checked prior to posting and checked a job where I use variables in the subject line of e-mails.
SURA
Premium Member
Premium Member
Posts: 1229
Joined: Sat Jul 14, 2007 5:16 am
Location: Sydney

Post by SURA »

Hi Ray / ArndW

Unfortunately i am not winning with the code and that could be the way how i tried to implement & Or that much only i might understood could be the reason and sorry for that.

Let me explain what i have did!

ArndW

Code: Select all

"#Getcount.$CommandOutput#<1>" OR #Getcount.$CommandOutput#<1>

and i got the below outputs in the Director.

Export_Individual_DSJob_1..JobControl (DSSendMail): Parameter 4 ('<1>"') does not start with a keyword


Export_Individual_DSJob_1..JobControl (DSSendMail): Parameter 4 ('<1>') does not start with a keyword
Then i tried the below

Code: Select all

CONVERT(@FM,'',#Getcount.$CommandOutput#)

Export_Individual_DSJob_1..JobControl (DSSendMail): Parameter 4 (')') does not start with a keyword
Ray

I tried the below code too.

Code: Select all

Oconv(Getcount.$CommandOutput,"MCN")
Job ran successfully, but in the email subject i am getting Oconv(Getcount.$CommandOutput,"MCN") .

Let me know how to handle this?
Thanks
Ram
----------------------------------
Revealing your ignorance is fine, because you get a chance to learn.
arunkumarmm
Participant
Posts: 246
Joined: Mon Jun 30, 2008 3:22 am
Location: New York
Contact:

Post by arunkumarmm »

Did you try with a user variable activity in between, passing your command output to a variable and then using your user variable in the email subject?
Arun
SURA
Premium Member
Premium Member
Posts: 1229
Joined: Sat Jul 14, 2007 5:16 am
Location: Sydney

Post by SURA »

Hi Guys

Thanks to all for your suggestions and guidance.

After added a Variable Activity before the email notification stage help me to pass the value in to the email subject.

Code: Select all

Trim (convert(@FM,',', Getcount.$CommandOutput),',',"A") 
Thanks
Ram
----------------------------------
Revealing your ignorance is fine, because you get a chance to learn.
Post Reply