Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
email an attachment through JCL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Other Mainframe Topics
Author Message
neeraj_pathak26

New User


Joined: 02 Jun 2006
Posts: 5

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
References
PostPosted: Thu Jun 19, 2008 1:22 pm    Post subject: Re: email an attachment through JCL Reply with quote

Srinivasa Rao

Active User


Joined: 21 Jun 2005
Posts: 77

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: 5

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

Senior Member


Joined: 06 Jun 2008
Posts: 600
Location: Atlanta, GA

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: 5

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

Senior Member


Joined: 06 Jun 2008
Posts: 600
Location: Atlanta, GA

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

Senior Member


Joined: 23 Aug 2005
Posts: 678
Location: chennai

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

Senior Member


Joined: 23 Aug 2005
Posts: 678
Location: chennai

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

Senior Member


Joined: 23 Aug 2005
Posts: 678
Location: chennai

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
Moved: Fri Jul 04, 2008 7:34 pm by superk From JCL to Other Mainframe Topics
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Other Mainframe Topics All times are GMT + 6 Hours
Page 1 of 1