Page 1 of 1

Record count to be sent in Dssendmail subroutine

Posted: Sun Aug 17, 2008 11:51 am
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

Posted: Sun Aug 17, 2008 12:28 pm
by chulett
What have you tried? And define 'rejects' in this context as sequential files don't typically generate reject records.

Record count in Dssendmail

Posted: Sun Aug 17, 2008 12:33 pm
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

Posted: Sun Aug 17, 2008 1:41 pm
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.

Posted: Sun Aug 17, 2008 4:48 pm
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.

Posted: Mon Aug 18, 2008 12:50 am
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.

Posted: Mon Aug 18, 2008 1:52 am
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.

Posted: Mon Aug 18, 2008 2:54 am
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.

Posted: Mon Aug 18, 2008 4:10 am
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.

Posted: Mon Aug 18, 2008 7:17 am
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.