Home      Mainframe Forum      Mainfarme Tutorials      IBM Manuals      Mainframe Interview Questions      Mainframe Books      IT News     SiteMap     Downloads


     
 
MAINFRAME - TIP OF THE DAY : When you specified V for RECFM parameter, LRECL value is largest record in the file plus 4 bytes. These four bytes contain the actual length of each variable length record in the file

Google
 
Web mainframegurukul.com

Sending an Email from JCL with attachment
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    mainframegurukul.com Forum Index -> JCL
  View previous topic :: View next topic  
Author Message
muraligaru1
Moderator


Joined: 11 Nov 2006
Posts: 43

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
2 salutes

PostPosted: Tue Oct 07, 2008 4:22 pm    Post subject: Sending an Email from JCL with attachment Reply with quote

Hi,

In my project, one of the requirement is to send the mail to a group of people. attach a sequential file to that mail.

I have the JCL to send a simple mail.... i dont know, how to send an attachment with it. Please provide the jcl for this.


Thanks for help.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.

Kalicharan
Moderator


Joined: 08 Feb 2006
Posts: 31

Answer was approved by Question owner.
Useful Post
1 votes
Not an useful post
Greate Post!! Salute Author
2 salutes

PostPosted: Wed Oct 08, 2008 10:34 am    Post subject: Reply with quote

This can be done using the below SAS program.

//MAILJCLX JOB (DEVLD,TEST),'MAILJCLX TEST',CLASS=X,MSGCLASS=X,NOTIFY=&SYSUID
//STEP0 EXEC SAS
//REPORT1 DD DSN=DVAN.MFDATASET.TEST,DISP=SHR
//SYSIN DD *
%LET MAILFILE = %SYSFUNC(PATHNAME(REPORT1));

DATA _NULL_;

CALL SYMPUT(?FDATE?, LEFT(PUT(?&SYSDATE?D-1,WORDDATE.)));

FILENAME LNOTE EMAIL TO=(?mail-id1? ?mail-id2?)
CC=(?ccmail-id1?)
BCC=(?bccmail-id1?)
SUBJECT =?TEST MAIL - &SYSDATE?
ATTACH =(?&MAILFILE? EXTENSION='TXT' TYPE='TEXT/PLAIN' NAME=?MFREPORT?);
DATA _NULL_;
FILE LNOTE ;
PUT
?This will be the content of the mail?;
PUT ' ';
RUN;

Here REPORT1 DSN will be send as attachment with the name MFREPORT.TXT in plain text format
to the mail-ids specified in ?FILENAME LNOTE EMAIL? with the subject TEST MAIL ? 03OCT08"
Back to top
View user's profile Send private message Send e-mail
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
muraligaru1
Moderator


Joined: 11 Nov 2006
Posts: 43

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Thu Oct 09, 2008 4:55 pm    Post subject: sending mail from JCL IEBGENER Reply with quote

Thanks Kalicharan.

Currently i am using IEBGENER to send a mail.

Is it possible to send an attachment using IEBGENER?
Please provide the JCL for the same.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Natarajan
Moderator


Joined: 10 Oct 2008
Posts: 537
Location: chennai

Answer was approved by Question owner.
Useful Post
1 votes
Not an useful post
Greate Post!! Salute Author
2 salutes

PostPosted: Sat Oct 11, 2008 2:16 pm    Post subject: sending an email from jcl with IEBGENER with attachment. Reply with quote

Try following code.

Code:
//SENDMAIL JOB (XXX,YYY),                                           
//             'MAIL FILE ',                                           
//             MSGCLASS=T,                                             
//             CLASS=S                                                                           
//*                                                                     
//STEP01   EXEC PGM=IEBGENER                                           
//SYSIN    DD  DUMMY                                                   
//SYSPRINT DD  SYSOUT=*                                                 
//SYSUT2   DD  SYSOUT=(M,SMTP)                                         
//SYSUT1   DD  DISP=SHR,                                               
//                  DSN=DEV.XXXX.TEST.FILE
//              DD DISP=SHR,     
//                  DSN=DEV.XXXX.TEST.FILE2(0)
//*     



Contents of the file DEV.XXXX.TEST.FILE :
helo JOBTRAC
MAIL FROM:<Natarajan@gmail.com>
rcpt to:<Natarajan@gmail.com>
data
FROM: xxxxx
TO: Natarajan@gmail.com
SUBJECT: test mail
Mime-Version: 1.0
Content-Type: text/plain; name="XYZZ.txt"
Content-Disposition: attachment; filename="XYZZ.txt"

DEV.XXXX.TEST.FILE2(0) is the file which should be send as attachment
Both files DCB?s should match.


Let me know, if you face any problems with this JCL
Back to top
View user's profile Send private message Visit poster's website
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
tavisha.sareen
Member


Joined: 24 Jan 2009
Posts: 6

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Sat Jan 24, 2009 2:46 am    Post subject: Reply with quote

I want to send multiple attachments in a single email through IEBGENER.Please suggest what needs to be done.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
snatcher
Member


Joined: 08 Feb 2009
Posts: 2
Location: Bangalore

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
1 salutes

PostPosted: Sun Feb 08, 2009 8:40 pm    Post subject: Reply with quote

tavisha.sareen wrote:
I want to send multiple attachments in a single email through IEBGENER.Please suggest what needs to be done.


Code:

//PLNMMX05 EXEC PGM=IEBGENER                                 
//SYSPRINT DD SYSOUT=*                                       
//SYSIN    DD DUMMY                                           
//SYSOUT   DD SYSOUT=*                                       
//SYSUDUMP DD SYSOUT=D                                       
//SYSUT2   DD SYSOUT=(B,SMTP)                                 
//SYSUT1   DD DSN=JSULNC.MAIL.HELLO,DISP=SHR               
//              DD DSN=JSULNC.MAIL.ATTACH1,DISP=SHR             
//            DD DSN=JSULNC.REPORT.TEXT1,DISP=SHR 
//         DD DSN=JSULNC.MAIL.ATTACH2,DISP=SHR
//            DD DSN=JSULNC.REPORT.TEXT2,DISP=SHR 


Contents of JSULNC.MAIL.ATTACH1 is:
Code:

--MIME                                 
CONTENT-TYPE: TEXT/PLAIN;NAME=RECY.TXT 
CONTENT-TRANSFER-ENCODING: 7BIT         
CONTENT-DISPOSITION: ATTACHMENT;       
FILENAME=JSULNC.BHAVANI.HELLO;         
                                       


Contents of JSULNC.MAIL.ATTACH2 is:
Code:
 
MIME-VERSION: 1.0                               
CONTENT-TYPE: MULTIPART/MIXED;BOUNDARY="MIME"   
                                               
--MIME                                         
CONTENT-TYPE: TEXT/PLAIN; CHARSET=US-ASCII     
CONTENT-TRANSFER-ENCODING: 7BIT                 
                                               
HI ,         
                                   
    PLEASE FIND THE ATTACHED REPORTS.

REGARDS
SUPPORT TEAM
                                               
--MIME                                         
CONTENT-TYPE: TEXT/PLAIN;NAME=DIFF.TXT         
CONTENT-TRANSFER-ENCODING: 7BIT                 
CONTENT-DISPOSITION: ATTACHMENT;               
FILENAME=JSULNC.REPORT.TEXT2;           



Note:DCB of JSULNC.MAIL.ATTACH1, JSULNC.MAIL.ATTACH2, JSULNC.REPORT.TEXT2 and JSULNC.REPORT.TEXT1 should be the same. New line breaks is a must.
_________________
Cheers!
Snatcher
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
tavisha.sareen
Member


Joined: 24 Jan 2009
Posts: 6

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Sat Feb 21, 2009 3:39 am    Post subject: Reply with quote

Where do we need to put the email addresses to which the email needs to be sent and also let me know the content of file JSULNC.MAIL.HELLO.
Thanks
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
snatcher
Member


Joined: 08 Feb 2009
Posts: 2
Location: Bangalore

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
1 salutes

PostPosted: Sat Feb 21, 2009 1:16 pm    Post subject: Reply with quote

Hi There,

I missed the contents of the JSULNC.SMTP.HELO, it is as follows:

Code:

HELO FELTG
MAIL FROM: <XXXXXXXXXXXXXX@YYYYYYY.CO.UK> 
RCPT TO: <yyyyyyyyyyyyyyyy@YYYYYYY.CO.UK> 
RCPT TO: <ZZZZZZZZZZZZZZ@YYYYYYY.CO.UK> 
DATA                                               
FROM: <XXXXXXXXXXXXXX@YYYYYYY.CO.UK> 
TO: <yyyyyyyyyyyyyyyy@YYYYYYY.CO.UK> 
CC: <ZZZZZZZZZZZZZZ@YYYYYYY.CO.UK> 
SUBJECT: Report files attached



Where FELTG is for handshaking, You should ask your mainframe admin for the handshake which you should use for successfull delivery of mail from your mainframe server.
_________________
Cheers!
Snatcher
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
tavisha.sareen
Member


Joined: 24 Jan 2009
Posts: 6

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
1 salutes

PostPosted: Mon Feb 23, 2009 9:14 am    Post subject: Reply with quote

I am trying to do the same way u suggested but then m still getting a single attachment in the mail.Also I have csv files to attch in the email.
Please suggest..

Thanks
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
subasu
Member


Joined: 24 Mar 2009
Posts: 12

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Mon Apr 13, 2009 1:11 pm    Post subject: Email with attachmet Reply with quote

Natarajan,

You JCL worked for an attachment. However, when I try to put in a body in the email like some written message, the attachment stops working. I am trying to put in the text/message between the SUBJECT and MINE-Version: 1.0. Please let me know if I am doing something wrong or suggest the correct format.

Thanks.
Subhadeep Basu.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Natarajan
Moderator


Joined: 10 Oct 2008
Posts: 537
Location: chennai

Answer was approved by Question owner.
Useful Post
1 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Mon Apr 13, 2009 8:37 pm    Post subject: Reply with quote

Hi Subhadeep,

Change the content of the file DEV.XXXX.TEST.FILE :

helo JOBTRAC
MAIL FROM:<Natarajan@gmail.com>
rcpt to:<Natarajan@gmail.com>
data
FROM: xxxxx
TO: Natarajan@gmail.com
SUBJECT: test mail
Mime-Version: 1.0
Content-Type: MULTIPART/MIXED;"SIMPLE BOUNDARY"
Hi,

How r you

Regards,
Natajan
--SIMPLE BOUNDARY
Content-Type: text/plain; name="XYZZ.txt"
Content-Disposition: attachment; filename="XYZZ.txt"


Let me know, if you still facing the issue.
_________________
Natarajan
Chennai
Back to top
View user's profile Send private message Visit poster's website
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
subasu
Member


Joined: 24 Mar 2009
Posts: 12

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
1 salutes

PostPosted: Tue Apr 14, 2009 9:19 am    Post subject: Reply with quote

Natarajan,

I am still facing the same issue, the mail is delivered, but there is no attachment, instead i get the following in the mail.
***********************************************************
Hi Nitin,
This is the test for body of the email
Thanks,
Subhadeep Basu
--SIMPLE BOUNDARY
Content-Type: text/plain; name="confirm.txt"
Content-Disposition: attachment; filename="confirm.txt"
PEON.CP000000.PCCS.FFB.CCS0P0000000000010000000000
************************************************************
The data"PEON.CP000000.PCCS.FFB.CCS0P0000000000010000000000" should come as an attachment.
-- Please let me know if you have a remedy for the same.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Natarajan
Moderator


Joined: 10 Oct 2008
Posts: 537
Location: chennai

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
1 salutes

PostPosted: Tue Apr 14, 2009 3:10 pm    Post subject: Reply with quote

Look like boundary is not working.. let me check and get back to you.
_________________
Natarajan
Chennai
Back to top
View user's profile Send private message Visit poster's website
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Natarajan
Moderator


Joined: 10 Oct 2008
Posts: 537
Location: chennai

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
1 salutes

PostPosted: Tue Apr 14, 2009 3:49 pm    Post subject: SMTP send attachment Reply with quote

Hi,

please check below code.

Code:

helo JOBTRAC
MAIL FROM:<Natarajan@gmail.com>
rcpt to:<Natarajan@gmail.com>
data
FROM: xxxxx
TO: Natarajan@gmail.com
SUBJECT: test mail
Mime-Version: 1.0
Content-Type: MULTIPART/MIXED;boundary="mainframegurukul"

--mainframegurukul
Content-type: text/plain

This is the body of the message.
--mainframegurukul
Content-Type: text/plain; name="XYZZ.txt"
Content-Disposition: attachment; filename="XYZZ.txt"




Make sure you have another PS file in SYSUT1, which contain following
--mainframegurukul--

OR

add this string at the end of the attachment data.
_________________
Natarajan
Chennai
Back to top
View user's profile Send private message Visit poster's website
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
subasu
Member


Joined: 24 Mar 2009
Posts: 12

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
3 salutes

PostPosted: Tue Apr 14, 2009 3:54 pm    Post subject: Reply with quote

Natarajan,

The following one worked.
===============================================
HELO SYSA
MAIL FROM:<XXXX@XXXX.COM>
RCPT TO:<XXXXX@XXXXX.COM>
DATA
FROM: <XXXXXXX@XXXX.COM>
TO: <XXXXXXX@XXXX.COM>
SUBJECT: Test Mail for attachment and body
MIME-Version: 1.0
Content-Type: MULTIPART/MIXED;
boundary="SIMPLE BOUNDARY"
--SIMPLE BOUNDARY

Hi Nitin,
This is the test for body of the email
Thanks,
Subhadeep Basu

--SIMPLE BOUNDARY
Content-Type: text/plain; name="confirm.txt"
Content-Disposition: attachment; filename="confirm.txt"
===============================================

Thanks for your help to get me started!!!
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Display posts from previous:   
Post new topic   Reply to topic    mainframegurukul.com Forum Index -> JCL All times are GMT + 5 Hours
Goto page 1, 2, 3  Next
Page 1 of 3



 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Cobol Tutorial
This cobol tutorial covers most of the important topics like STRING, UNSTRING, COMP, COMP-3.....
DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. Explains in simple language. Some Chapters are locked, Forum members have free access to these chapters
CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming...
JCL Tutorial
This is most popular JCL tutorial from mainframegurukul. It does contain important jcl ....
SORT Tutorial
This Tutorial covers all important aspects of DFSORT. Has more SORT examples
INTERVIEW Questions
This page covers important interview questions
Mainframe Jobs
Mainframe Jobs posted by members of mainframegurukul forum
FaceBook Page
MainframeGurukul FaceBook Page
LinkedIn Page
MainframeGurkul Linkedin Page

This widget requires Flash Player 9 or better







Go to top of the page
 

Online ABEND Reference ||  JCL References ||  COBOL References ||  VSAM References ||  Tutorials by Drona Series ||  SQL tutorial ||  BOOKS  ||  DB2 INTERVIEW QUESTIONS ||  COBOL INTERVIEW QUESTIONS  ||  JCL INTERVIEW QUESTIONS ||  JCL2 INTERVIEW QUESTIONS ||  VSAM INTERVIEW QUESTIONS ||  CICS INTERVIEW QUESTIONS  ||  Online tutorials ||  Online ABEND Reference ||  JCL References ||  COBOL References ||  VSAM References ||  Tutorials by Drona Series ||  SQL tutorial ||  BOOKS  ||  SiteMap  ||  Expeditor Tutorial  ||  FILE-AID Tutorial  ||  Changeman Tutorial  ||  COBOL   ||  DB2   ||  JCL  ||  CICS  ||  VSAM  ||  DB2 Interview Questions ( 110 )   || Simple JCL Tutorials  || JCL Tutorial from MainframeGurukul.com   || Simple JCL Tutorial - Chapter1 ;|| Mainframe Forum - Tutorials  || Mainframe Tutorials || Mainframe CICS tutorial|| Mainframe COBOL Tutorial

Drona Educational Forums - Mainframe Cobol DB2 CICS Board
Powered by phpBB

mainframetopic-3508.html