Need to send Attachment in mail thru JCL.

In this Mainframe Forum - You can post your queries on JCL, OS/390 JCL, MVS JCL, z/OS JCL, JES2 & JES3

Moderators: Frank Yaeger, DikDude, Moderator Group

Post Reply
gp99516
Member
Posts: 7
Joined: Wed May 11, 2011 5:26 pm

Need to send Attachment in mail thru JCL.

Post by gp99516 » Wed May 11, 2011 5:47 pm

Hi Guru's,

Requirement--> Send a notepad attachment to USER@xxx.com along with notepad populated with records in GDG file created in previous step.

Success:I have created a jcl which is able to send a notepad attachment to desired mail address.

Fail: I falied to copy the GDG(0) in this notepad.

//JS000020 EXEC MAILOUT,COND=(04,LT)
//*MAIL DD DSN=IS00711.E.CNTLCARD(AUTOMAIL),DISP=SHR
//MAIL DD DISP=SHR,
// DSN=IS00711.E.CNTLCARD(ATOMAIL1)
// DD DISP=SHR,
// DSN=IS00711.E.MC00JCL5.LCX4.T705LOD(+0)
//


********contents of ATOMAIL1************************
xxx.xx.x.143
TO: XXXXX@headstrong.com
DATA
SUBJECT: automation testing
MIME-VERSION: 1.0
CONTENT-TYPE: MULTIPART/MIXED;
BOUNDARY="----_=_NEXTPART_000_01C0DFAD.3EF4A2D0"

This message is in MIME format. Since your mail
reader does not understand this format, some or
all of this message may not be legible.
Body is in HTML format...

------_=_NEXTPART_000_01C0DFAD.3EF4A2D0
CONTENT-TYPE: text/html
<font face="ARIAL" color="#0000FF" size="2">
Testing automation. <br>
MEDS704 bakcup <br>
</font>
------_=_NEXTPART_000_01C0DFAD.3EF4A2D0
CONTENT-TYPE: TEXT/PLAIN;
name="MEDS704.txt"
********************************************************

This content can send me mail but i am not able to copy a data set DSN=IS00711.E.MC00JCL5.LCX4.T705LOD(+0) to my notepad attachment.


-----------------------------------------------------------------------------------
I alos tried with IEBGENER as suggested in other posts in this site.

//JS000010 EXEC PGM=IEBGENER
//OUTPUT DD SYSOUT=*
//SYSIN DD DUMMY
//SYSUT1 DD DISP=SHR,
// DSN=IS00711.E.CNTLCARD(AUTOMAIL) -->Same as above
// DD DISP=SHR,
// DSN=IS00711.E.AUTOMCL5.TEST1
//SYSUT2 DD SYSOUT=(B,SMTP)
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//*
//*
//* SEND EMAIL CONCAT. HEADER / DATA / TRAILER.
//*----------------------------------------------

but this doesnt send me any mail. anybody care to suggest as this is the first time i am working with MIMe and mail attachments.
Thanks in advance.

gp99516
Member
Posts: 7
Joined: Wed May 11, 2011 5:26 pm

Post by gp99516 » Wed May 11, 2011 5:50 pm

Also like to add that GDG(0) do i need to add a boundary at the end of this file??
as below or it doesn't matter?
MVS 22222 dsdasdf 20110201
--boundary

MrSpock
Active Member
Posts: 273
Joined: Wed Jun 27, 2007 5:37 pm

Post by MrSpock » Wed May 11, 2011 6:42 pm

#1. We don't know what your MAILOUT PROC does.
#2. You honestly don't have software that you can use to handle this without YOU having to code SMTP and MIME instructions?
#3. There's no traces or debugging logs you can review?
#4. What is the standard procedure for doing this at your site? If I'm understanding your post, you HAVE sucessfully sent an email with an attachment? If so, then what's the difference?

gp99516
Member
Posts: 7
Joined: Wed May 11, 2011 5:26 pm

Post by gp99516 » Wed May 11, 2011 7:11 pm

Thanks MrSpock for quick response,
#2 I want this to be done automatically rather then going thru start 6.
#3 Rc is coming Zero if done with IEBGENER but no mail is turning out.
with sysprint info as follows.

OUTPUT LRECL = 80, BLKSIZE = 27920, TYPE = FB
INSERT 0, DELETE 0
RECORDS - IN: 25, OUT: 25
SMF RECORD NOT WRITTEN TO THE SMF DATA SET(RC=20)
END OF DFSORT

#4 In my site they dont send attachments in mail this is what i am trying to achieve. i am able to get the attachement but its an empty attachment. i want my gdg records in it. which is missing.

i have seen the posts here which has achieved the same with IEBGENER some how not working for me. need little help

MrSpock
Active Member
Posts: 273
Joined: Wed Jun 27, 2007 5:37 pm

Post by MrSpock » Wed May 11, 2011 8:32 pm

Have you seen this website, or followed some of it's advice?

http://planetmvs.com/mvsmail/index.html

gp99516
Member
Posts: 7
Joined: Wed May 11, 2011 5:26 pm

Post by gp99516 » Thu May 12, 2011 10:31 am

Thanks,
Mr Spock its working for me.
My Fault--> I missed setting the boundary afte giving the filename. which made my notead not able to pick the records and concatenate in the notepad mime Dataset.

// DD DISP=SHR,
// DSN=IS00711.E.CNTLCARD(ATOMAIL1) -->HERE after filename i dint mention Boundary
// DD DISP=SHR,
// DSN=IS00711.E.MC00JCL5.LCX4.T705LOD(+0)

its wrking well now. thanks alot for all ur support. after this i realised the importance of Boundaries in MIME.


PHASE II
I have a similar requirement but instead of receiving notepad attachments i would like to get it on Spread sheet. with the records populated in correct column. Please let me know if this can be achieved thru chaning mime Content type?

Guru's Please give me some directions. Thanks in advance.

MrSpock
Active Member
Posts: 273
Joined: Wed Jun 27, 2007 5:37 pm

Post by MrSpock » Thu May 12, 2011 12:50 pm

Not that I'm aware of. You'd have to research it a bit, but I believe Text/Html is pretty much the standard unless you have binary files.

gp99516
Member
Posts: 7
Joined: Wed May 11, 2011 5:26 pm

Post by gp99516 » Thu May 12, 2011 2:06 pm

Hi Mr Spock,
Best thing is I have plenty of time as of now to research on this nothing URGENT.
I will dig around it and update my Research on this post.

Thanks for Guiding.

MrSpock
Active Member
Posts: 273
Joined: Wed Jun 27, 2007 5:37 pm

Post by MrSpock » Fri May 13, 2011 10:25 pm

gp99516, going back to my original answer, you don't have SAS or something similar that can do all of this work for you?

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others