Page 1 of 1

file attachment in mail

Posted: Thu Oct 26, 2006 3:53 am
by ssunda6
Hi ,

Iam able to send mails using DSSendMail routine. I have a requirement of attaching a file which contains rejected records and send mail to clients ID. The file is getting attached, but it is not in readable format. It is just showing some squares as data. I am writing the rejected records to a txt file in datastage using sequential file stage. And Iam attaching the same file using DSSendMail after job subroutine.

DSSendMail("From:xx@yy.com\nTo:dd@zz.com\nSubject:Test Mail\nAttach:/xx/tt/xx/temp.txt\nBody:Hi%report%");

Plz let me know what the problem is.

regards,
ssunda.

Re: file attachment in mail

Posted: Thu Oct 26, 2006 3:56 am
by sudeepmantri
Hi,

DSSendMail function often gives error of these kind. Instead why dont you use the Notification Activity. It works really good

Posted: Thu Oct 26, 2006 7:23 am
by rameshrr3
If using version 7.5x , you can use mail attachment tester

Code: Select all

DSSendMailAttachmentTester
Routines->Built-In-->Utilities.

It works pretty okay for some of my jobs

Re: file attachment in mail

Posted: Thu Oct 26, 2006 9:22 am
by DeepakCorning
I had a little different problem , the file attachment was failing because the file was locked.and hence was not able to send it. So as a work around I removed the after job subroutine and added a hashed file which sourced from the sequential file and then after that hashed file added one more transformer and used the routine in the Transformer to send this file. As the Seq file is locked till the hashed file is loaded but the mail routine will not get kicked till the hashed file is loaded completely so it waits. After the file is loaded the SEQ file is release and hence i was able to send it. well My requirement was to send the file on a particualr condition so I had to do this all , you can simply use the Notification Activitiy.

Posted: Thu Oct 26, 2006 11:52 pm
by ssunda6
hi deepak,

Iam able to attach file in mail. Iam receiving that mail with file attached. But the problem is all records are being sequentially placed instead of writing 1 record on each row. And in b/w the records, there is one speical character(a square). appering in the text file.I tried with all delimiter options ,still Iam unable to getrid of that special character.

The data in the original file is as below:

"0"
"1"
"2"
"3"
"4"
"5"
"6"
"7"
"8"
"9"

But in the file that im getting thru mail, all the numbers are continuously placed with squares in between. The new line in the file is being placed as a square.

regards
ssunda
[/img]

Posted: Fri Oct 27, 2006 12:02 am
by chulett
I would guess you are creating a UNIX file and then emailing it to your Windows machine. Try creating the file as a DOS file instead.

Posted: Fri Oct 27, 2006 12:39 am
by ssunda6
Hi chulett,

You are right. we are creating files on unix and emaling to windows. I think I will not be able to create DOS files as the server on which our Datastage is working is on unix operating system.

Any other options that will enable us to view the data properly??

thanx in advance,

regards,
ssunda

Posted: Fri Oct 27, 2006 7:37 am
by ray.wurlod
Just change the terminator property (Stage properties) from UNIX-style to DOS-style. This will put CRLF instead of LF at the end of each line.

Having just noticed that you are using parallel jobs, please ignore the previous advice. Instead, use 010 as the final delimiter character.

Posted: Fri Oct 27, 2006 7:41 am
by chulett
ssunda6 wrote:You are right. we are creating files on unix and emaling to windows.
Actually, what I said was you are creating a UNIX file, not creating files on UNIX. Different thing and as Ray noted, it's all about the record terminator you've chosen in the stage. Change it to 'DOS' so it uses CR/LF pairs rather than just the LFs that UNIX needs.

Granted, it will look a little funky on your UNIX server, but should sort out the 'problem' with the attachment.

Ok... '010' not 'DOS' then for a PX job. :?

Posted: Sun Oct 29, 2006 10:30 pm
by ssunda6
Hi

Thnx Ray and Chulett for the relies. I will try them out now and get back to u.

Ray, only a part of ur post is visible. I am not a charter member. Plz post it again, so that I can read the solution u gave.

regards,
ssudna

Posted: Mon Oct 30, 2006 7:32 am
by ray.wurlod
ssunda, please fork over a mere 14 cents per day ($49 per year) so that you can read premium posts, and help us to fund this site. You don't want it to disappear, do you?

Posted: Tue Oct 31, 2006 12:48 am
by ssunda6
yup, I dont want this group to disappear.

:)

Posted: Tue Oct 31, 2006 5:19 am
by ssunda6
Hi Ray,Chulett,

Thanx a lot for the solutions. I used record terminator as DOS-terminator and now i have proper text files in my mails.

regards,
ssunda

Posted: Tue Oct 31, 2006 8:03 am
by chulett
Excellent. :D