file attachment in mail

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
ssunda6
Participant
Posts: 91
Joined: Tue Sep 19, 2006 9:32 pm

file attachment in mail

Post 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.
sudeepmantri
Participant
Posts: 54
Joined: Wed Oct 25, 2006 11:07 pm
Location: Hyderabad

Re: file attachment in mail

Post by sudeepmantri »

Hi,

DSSendMail function often gives error of these kind. Instead why dont you use the Notification Activity. It works really good
rameshrr3
Premium Member
Premium Member
Posts: 609
Joined: Mon May 10, 2004 3:32 am
Location: BRENTWOOD, TN

Post 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
DeepakCorning
Premium Member
Premium Member
Posts: 503
Joined: Wed Jun 29, 2005 8:14 am

Re: file attachment in mail

Post 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.
ssunda6
Participant
Posts: 91
Joined: Tue Sep 19, 2006 9:32 pm

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

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ssunda6
Participant
Posts: 91
Joined: Tue Sep 19, 2006 9:32 pm

Post 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
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
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 »

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

"You can never have too many knives" -- Logan Nine Fingers
ssunda6
Participant
Posts: 91
Joined: Tue Sep 19, 2006 9:32 pm

Post 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
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ssunda6
Participant
Posts: 91
Joined: Tue Sep 19, 2006 9:32 pm

Post by ssunda6 »

yup, I dont want this group to disappear.

:)
ssunda6
Participant
Posts: 91
Joined: Tue Sep 19, 2006 9:32 pm

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

Post by chulett »

Excellent. :D
-craig

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