Record count to be sent in Dssendmail subroutine

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
happyramana1
Participant
Posts: 11
Joined: Thu Jun 05, 2008 7:32 am

Record count to be sent in Dssendmail subroutine

Post by happyramana1 »

I would like to send a mail to sourcing team about rejects. I am using Dssendmail subroutine in the after subroutine stage(xfm stage). i need to include the no of records rejected in this routine to be sent out in the mail.

My job design is

src----xfm---seq file
-
-
-
-
Reject seq file
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

What have you tried? And define 'rejects' in this context as sequential files don't typically generate reject records.
-craig

"You can never have too many knives" -- Logan Nine Fingers
happyramana1
Participant
Posts: 11
Joined: Thu Jun 05, 2008 7:32 am

Record count in Dssendmail

Post by happyramana1 »

chulett wrote:What have you tried? And define 'rejects' in this context as sequential files don't typically generate reject records. ...
its not the reject comes out of seq file. its from the xfm stage where records are rejected with a constraint set in xfm stage. using @outrownum i can have the number of records sent to reject file, but i have no clue as how this info can be included in the Dssendmail subroutine
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Write a routine to wrapper the DSSendMail call and pass that System Variable in as an argument. Then incorporate it in the 'body' string when build the call to send the mail.
-craig

"You can never have too many knives" -- Logan Nine Fingers
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Hmmm... that may not be possible. In the routine, use DSJ.ME and DSJ.LINKROWCOUNT with DSGetLinkInfo() to retrieve the count on that link.
-craig

"You can never have too many knives" -- Logan Nine Fingers
happyramana1
Participant
Posts: 11
Joined: Thu Jun 05, 2008 7:32 am

Post by happyramana1 »

this is how i code in the afterstage subroutine

From:abc@x.com\nTo:cba@x.com\nserver:x.com\nAttach:D:\Seq_reject.txt\nBody:%DSGetLinkInfo(DSJ.ME,DSJ.ME,DSJ.ME,DSJ.LINKROWCOUNT)% reject found \n%report%

can we use the DsFunction inside the body of the Dssendmail subroutine, if yes is the syntax right, i am not getting the desired output

Desired output is a mail sent to cba@x.com with the record count int the body of the mail.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Show us your actual code - in particular what you do with that string. I would suggest that at least some concatenation is in order to build the string.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
happyramana1
Participant
Posts: 11
Joined: Thu Jun 05, 2008 7:32 am

Post by happyramana1 »

i need to send a mail to sourcing team, in the body of the mail i should mention 107 records have been rejected.

this count 107 should be inserted in the body of the mail

For sending the mail i am using Dssendmail routine in the afterstage subroutine

In the Dssendmail routine inside the body of the mail i am trying to use the function DSGetLinkInfo

so my code lookks like this

From:xyz@abc.com\nTo:.pqr@abc.com\nserver:abc.com\nAttach:D:\Seq_reject.txt\nBody: %DSGetLinkInfo(DSJ.ME,DSJ.ME,DSJ.ME,DSJ.LINKROWCOUNT)% rejects found \n%report%

Can we use Dsfunction inside body part of Dssendmail.

If yes is there something wrong with the syntax i have used.

I am not getting the desired output.

Instead the mail looks like this

%DSGetLinkInfo(DSJ.ME,DSJ.ME,DSJ.ME,DSJ.LINKROWCOUNT)% rejects found

Actually i intend to get 107 rejects found.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You need to obtain the results of DSGetLinkInfo() and concatenate that into the string. The string that you pass to DSSendMail() will therefore have a generating expression of the form

Code: Select all

"From:xyz@abc.com\nTo:.pqr@abc.com\nserver:abc.com\nAttach:D:\Seq_reject.txt\nBody: %" :DSGetLinkInfo(DSJ.ME,DSJ.ME,DSJ.ME,DSJ.LINKROWCOUNT) : "% rejects found \n%report%" 
I'm not even 100% sure about that - you seem to have rather more "%" characters than necessary.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You can only use DSJ.ME for the job handle, the other two will need to be the actual stage and link names. And you don't use any percent signs, those are strictly for the template not what you pass.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply