Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

email an attachment through JCL
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> All Other Mainframe Topics
View previous topic :: :: View next topic  
Author Message
neeraj_pathak26

New User


Joined: 02 Jun 2006
Posts: 7

PostPosted: Thu Jun 19, 2008 1:22 pm    Post subject: email an attachment through JCL
Reply with quote

Hi , I am trying to send a report which is a sequential dataset to certain group as email.
I use a below step to do normal emailing through jcl
Code:
//STEP040  EXEC PGM=IEBGENER             
//SYSPRINT DD SYSOUT=*                   
//SYSIN    DD DUMMY                       
//SYSUT1   DD DISP=SHR,DSN=TEST.EMAIL.INFO
//         DD DISP=SHR,DSN=TEST.REPORT   
//SYSUT2   DD SYSOUT=A,DEST=(destination),
//            DCB=(RECFM=F,BLKSIZE=133)


TEST.EMAIL.INFO has below information
Code:
[i][b]HELO XXXXXXX                         
MAIL FROM:<SOURCE>                   
RCPT TO:<NEERAJ@REDIFF.COM>         
DATA                                 
DATE:                               
FROM:     TESTJOB                   
TO:       GROUP                     
SUBJECT:  TEST REPORT FOR THIS MONTH. [/b][/i]


and TEST.REPORT has the information which I want to email.

If I use the above step it sends the email having all the report data in the mail it self, but I want to email TEST.REPORT as an attachment.
[/code]
Back to top
View user's profile Send private message

Srinivasa Rao

New User


Joined: 21 Jun 2005
Posts: 75

PostPosted: Thu Jun 19, 2008 4:33 pm    Post subject:
Reply with quote

Hi Neeraj,

You need to specify boundries as below. Try it.


//STEP010 EXEC PGM=IEBGENER
//SYSIN DD DUMMY
//SYSPRINT DD SYSOUT=*
//SYSUT2 DD SYSOUT=B,DEST=SMTP
//SYSUT1 DD *
helo JESNDIXA
mail from:<XXXXXX@JESNDIXA>
rcpt to:<XXXXXXX@XXXXX.COM >
data
From: MAINFRAME
To: XXXXXXXX@XXXXXX.com
Subject: Test attachment
MIME-Version: 1.0
Content-type: multipart/mixed;
boundary="simple boundary"
--simple boundary
CONTENT-TYPE: TEXT/PLAIN; CHARSET="US-ASCII"
CONTENT-TRANSFER-ENCODING: 7BIT
Hello,
Please find a test email with attachment sent via SMTP:


--simple boundary
--simple boundary
CONTENT-TYPE: APPLICATION/OCTET-STREAM;
CONTENT-DISPOSITION:ATTACHMENT;FILENAME="Vault.doc"
/*
// DD DISP=SHR,DSN=GADMPD.CA1.VMSRPT.BRIT
// DD *
--simple boundary
--simple boundary
CONTENT-TYPE: TEXT/PLAIN; CHARSET="US-ASCII"
CONTENT-TRANSFER-ENCODING: 7BIT

Regards
-Srinivasa

--simple boundary
Back to top
View user's profile Send private message
neeraj_pathak26

New User


Joined: 02 Jun 2006
Posts: 7

PostPosted: Mon Jun 23, 2008 10:38 am    Post subject: Reply to: email an attachment through JCL
Reply with quote

Hi Srinivasa,
I tried this one, but It seems it did not work, I got the email but there were no attachment, all details came in email only which I wanted to send as attachment. Along with the email data I got sysin data also

BOUNDARY="SIMPLE BOUNDARY"
--SIMPLE BOUNDARY
CONTENT-TYPE: TEXT/PLAIN; CHARSET="US-ASCII"
CONTENT-TRANSFER-ENCODING: 7BIT
HELLO,
PLEASE FIND A TEST EMAIL WITH ATTACHMENT SENT VIA SMTP:
--SIMPLE BOUNDARY
--SIMPLE BOUNDARY
CONTENT-TYPE: APPLICATION/OCTET-STREAM;
CONTENT-DISPOSITION:ATTACHMENT;FILENAME="VAULT.DOC"
Quote:


I appreciate your help.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7908
Location: Bellevue, IA

PostPosted: Mon Jun 23, 2008 5:27 pm    Post subject:
Reply with quote

This code sends the data as a text attachment:
Code:
//MAILPROC EXEC PGM=IEBGENER
//SYSABEND DD   SYSOUT=*
//SYSTOTAL DD   SYSOUT=*
//SYSLIST  DD   SYSOUT=*
//SYSPRINT DD   SYSOUT=*
//SYSUT2   DD   SYSOUT=(9,SMTP)
//SYSIN    DD   DUMMY
//*
//SYSUT1 DD *
HELO MAINFRAME.********
MAIL FROM: <MAINFRAME@********>
RCPT TO: <RSAMPLE@********>
DATA
FROM:     MAINFRAME@********
TO:       ROBERT SAMPLE
SUBJECT:  TEST ATTACHMENT
MIME-VERSION: 1.0
CONTENT-TYPE: TEXT/PLAIN
CONTENT-DISPOSITION: ATTACHMENT; FILENAME=FILE.TXT
//       DD DSN=TTSSRS0.JCL.CNTL(EMAILATT),DISP=SHR
//       DD DSN=TTSSRS0.JCL.CNTL(EMAILAT),DISP=OLD
Back to top
View user's profile Send private message
neeraj_pathak26

New User


Joined: 02 Jun 2006
Posts: 7

PostPosted: Tue Jun 24, 2008 3:02 pm    Post subject: Reply to: email an attachment through JCL
Reply with quote

Hi Robert,
Thanks for Reply.
Can you please let me know that what the control cards are containing? below are the control cards you have coded in your jcl.
Quote:
CONTENT-DISPOSITION: ATTACHMENT; FILENAME=FILE.TXT
// DD DSN=TTSSRS0.JCL.CNTL(EMAILATT),DISP=SHR
// DD DSN=TTSSRS0.JCL.CNTL(EMAILAT),DISP=OLD.


Also which dataset will go as FILE.TXT in the email?
I appreciate your help!
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7908
Location: Bellevue, IA

PostPosted: Tue Jun 24, 2008 3:19 pm    Post subject:
Reply with quote

The data in TTSSRS0.JCL.CNTL(EMAILATT) becomes the attachment. The EMAILAT member is a single period on a line by itself (required by RFC 2821).
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 680
Location: NJ

PostPosted: Thu Jul 03, 2008 7:46 pm    Post subject: Reply to: email an attachment through JCL
Reply with quote

Hi,

I have 3 reports to send daily. Ihave coded such that to attach a single report. But i am unable to attach all the three report in a single mail. Do any one have an idea on this? Please advise
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 680
Location: NJ

PostPosted: Fri Jul 04, 2008 3:18 pm    Post subject: Reply to: email an attachment through JCL
Reply with quote

Any positive resolutions????
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 680
Location: NJ

PostPosted: Fri Jul 04, 2008 7:17 pm    Post subject: Reply to: email an attachment through JCL
Reply with quote

If i try to include
"Hello,
Please find a test email with attachment sent via SMTP:
"

I am not getting in mail. if i try with alternate way it's coming in the attachement itself. Please advise.
Back to top
View user's profile Send private message
jack.arden

New User


Joined: 30 Jan 2009
Posts: 3
Location: New Jersey

PostPosted: Sat Jan 31, 2009 3:08 am    Post subject: Sending E-mail attachments from the mainframe
Reply with quote

I have tried the above approach and the report is appearing in the body of the e-mail not as an attachment. Also, this only works if the dataset to be sent is 80 bytes, if it is 133 as any report I get a JCL error.
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Sat Jan 31, 2009 3:24 am    Post subject: Reply to: email an attachment through JCL
Reply with quote

If you're concatenating datasets, make sure you follow the rules of concatenation (they should all have the same RECFM and LRECL) in your job ...
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Sat Jan 31, 2009 3:54 am    Post subject:
Reply with quote

Hi,



Quote:
this only works if the dataset to be sent is 80 bytes, if it is 133 as any report I get a JCL error.


I doubt this would result in a JCL error, maybe a non zero return code or an abend.


Gerry
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sat Jan 31, 2009 4:08 am    Post subject:
Reply with quote

Hello Jack and welcome to the forum,

It will probably help if you post the jcl/control statements used along with the actual error message(s) and the id's that go with them. . .

When posting jcl, code, etc, it is best to use copy/paste and the "Code" tag (top center of the reply panel). Use Preview see how your post will appear to the forum and when you are satisfied, Submit.

Please do not attach screenshots. . .
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7908
Location: Bellevue, IA

PostPosted: Sat Jan 31, 2009 5:02 am    Post subject:
Reply with quote

I've got someone at work that uses this format to send 998-byte records. The SYSUT1 DD statement points to a DSNAME with LRECL=998, and the concatenated files are both LRECL=998. This works fine in production every day for us. The MAIL FROM and RCPT TO fields are different but they and the other statements are all part of the LRECL=998 dataset.
Back to top
View user's profile Send private message
jack.arden

New User


Joined: 30 Jan 2009
Posts: 3
Location: New Jersey

PostPosted: Mon Feb 02, 2009 8:51 pm    Post subject:
Reply with quote

The jcl submitted is:
Code:

//EXT2MAIL EXEC PGM=IEBGENER                                 
//SYSABEND DD   SYSOUT=*                                     
//SYSTOTAL DD   SYSOUT=*                                     
//SYSLIST  DD   SYSOUT=*                                     
//SYSPRINT DD   SYSOUT=*                                     
//SYSUT2   DD   SYSOUT=(9,SMTP)                               
//SYSIN    DD   DUMMY                                         
//*                                                           
//SYSUT1 DD *                                                 
HELO       CHAR.MVS.US.XXX.COM                               
MAIL FROM: <JARDEN@XXX.COM>                                   
RCPT TO:   <JARDEN@XXX.COM>                                   
DATA                                                         
TO: <JARDEN@XXX.COM>                                         
FROM: <APP1JJAX JOB>                                         
SUBJECT: TEST E-MAIL NOTIFICATION                             
===============================================
   JOB APP1JJAX COMPLETED (SEE ATTACHMENT)                   
MIME-VERSION: 1.0     
CONTENT-TYPE: TEXT/PLAIN                                 
CONTENT-DISPOSITION: ATTACHMENT; FILENAME=FILE.TXT       
//       DD DSN=APP.APP1JJA.REPORT1,DISP=SHR             
//       DD DSN=APP.APP1JJA.JCL(PERIOD),DISP=SHR         
//                                                                               

The e-mail received is:

===============================================
JOB APP1JJAX COMPLETED (SEE ATTACHMENT)
MIME-VERSION: 1.0
CONTENT-TYPE: TEXT/PLAIN
CONTENT-DISPOSITION: ATTACHMENT; FILENAME=FILE.TXT
N828TEST TEST REPORT

NAME ADDRESS

JOHN DOE 123 MAIN STREET ANYTOWN, NJ 07000

JANE DOE 999 ANOTHER RD ATOWN, NY 11200

.


Notice the "." at the end. What I want is for the part starting at N828TEST to be in an attachment.
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Mon Feb 02, 2009 9:11 pm    Post subject: Reply to: email an attachment through JCL
Reply with quote

Where's all of the MIME protocol code? All I see is the SMTP protocol code. There looks to be a lot missing, unless it's included in one of the concatenated datasets.
Back to top
View user's profile Send private message
jack.arden

New User


Joined: 30 Jan 2009
Posts: 3
Location: New Jersey

PostPosted: Wed Jun 10, 2009 1:27 am    Post subject:
Reply with quote

MIME protocol code??? Please provide sample
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Wed Jun 10, 2009 2:08 am    Post subject: Reply to: email an attachment through JCL
Reply with quote

Planet MVS MVS Mail page.
Back to top
View user's profile Send private message
Nair47

New User


Joined: 13 Jun 2009
Posts: 2
Location: vizag

PostPosted: Sat Jun 13, 2009 6:15 pm    Post subject: Reply to: email an attachment through JCL
Reply with quote

can any one please tell me....wat is this helo ***** means.
when iam trying to execute the code iam getting maxcc=0, but mail is not been sent.


//G107525J JOB ,,NOTIFY=&SYSUID,CLASS=B,MSGLEVEL=(1,1),MSGCLASS=X
//IEBGENER EXEC PGM=IEBGENER
//SYSIN DD DUMMY
//SYSPRINT DD SYSOUT=*
//SYSUT2 DD SYSOUT=(B,SMTP)
//SYSOUT DD SYSOUT=*
//SYSUT1 DD *
HELO 192.168.100.74
MAIL FROM :<mailid1>
RCPT TO :<mailid2>
DATA
FROM :<mailid1>
TO :<mailid2>
SUBJECT:TEST
HI..... WAT DOING?
REGARDS,
RAJESH
/*
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7908
Location: Bellevue, IA

PostPosted: Sat Jun 13, 2009 7:07 pm    Post subject:
Reply with quote

To find out what the HELO means, pull up the IETF document RFC 2821 and read it. This document gives you the exact specifications for Internet emails and the different options there of. Google can help you find it.

How do you know the mail has not been sent? Since you obfuscated the precise email address, I recommend you contact your site support group and have them check the SMTP job output to see if your email did, indeed, get sent. Note that having the email go out of the mainframe does not mean you will see it at <mailid2>. That would depend upon whether the mail server was set up appropriately to handle mainframe emails. You really, really, really must get site support people involved to resolve this since there are a number of areas where an email can go awry and only they can help you figure out what is going on.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> All Other Mainframe Topics All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Reading data from PS file and send it... rajatbagga All Other Mainframe Topics 18 Fri Sep 23, 2016 12:51 pm
No new posts How to send email with Rich Text usin... santhosh5983 JCL & VSAM 4 Fri Apr 08, 2016 2:30 am
No new posts Issue in sending zip file as mail att... ajithajt JCL & VSAM 8 Thu Apr 07, 2016 9:11 am
No new posts Email trigger through JCL Madhusudhan Prahlad JCL & VSAM 10 Mon Aug 31, 2015 3:43 pm
No new posts Empty excel attachment in mail receiv... gs185008 COBOL Programming 8 Mon Jul 13, 2015 7:45 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us