Page 1 of 1
attach multiple files (10) in one e-mail
Posted:
Wed May 05, 2010 11:02 pm
by sdc872
Hello,
I need to attach multiple files (10) in one e-mail via JCL. Is that possible? I started with trying to attach 2 files. I figured if I could figure out how to attach 2, I can do 10. Here is what I tried so far:
//SENDNOTE EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT2 DD SYSOUT=(B,SMTP)
//SYSIN DD DUMMY
//SYSUT1 DD *,LRECL=132
//SYSUT1 DD *,LRECL=132
HELO SYSA
MAIL FROM:sdc@xyz.com
RCPT TO:sdc@xyz.com
DATA
FROM:sdc@xyz.com
TO:sdc@xyz.com
SUBJECT: TEST REPORT APRIL 2010
MIME-VERSION: 1.0
CONTENT-TYPE: MULIPART/MIXED; CHARSET=US-ASCII
CONTENT-DISPOSITION: ATTACHMENT; FILENAME=TEST.REPORT.APRIL.DOC
CONTENT-DISPOSITION: ATTACHMENT; FILENAME=TEST.REPORT2.APRIL.DOC
// DD DISP=SHR,DSN=TEST.REPORT.M0410
// DD DISP=SHR,DSN=TEST.REPORT2.M0410
Please help! Thanking you in advance.....
Re: Sending Email from JCL
Posted:
Wed May 05, 2010 11:37 pm
by Robert Sample
Yes, using MIME allows for multiple attachments. This is input into an IEBGENER that copies it to our SMTP output and it delivers multiple attachments:
//SYSUT1 DD *
HELO MAINFRAME.xxxxxxxx.COM
MAIL FROM: <MAINFRAME@xxxxxxxx.COM>
RCPT TO: <RSAMPLE@xxxxxxxx.COM>
DATA
FROM: MAINFRAME@xxxxxxxx.COM
TO: ROBERT.SAMPLE@xxxxxxxx.COM
SUBJECT: TEST ATTACHMENT
MIME-VERSION: 1.0
CONTENT-TYPE: MULTIPART/MIXED; BOUNDARY="SIMPLE BOUNDARY"
--SIMPLE BOUNDARY
CONTENT-TYPE: TEXT/PLAIN
CONTENT-DISPOSITION: ATTACHMENT; FILENAME=EMAILATT.TXT
// DD DISP=SHR,DSN=TTSSRS0.JCL.CNTL(EMAILATT)
// DD *
--SIMPLE BOUNDARY
CONTENT-TYPE: TEXT/PLAIN
CONTENT-DISPOSITION: ATTACHMENT; FILENAME=EMAILTST.TXT
// DD DISP=SHR,DSN=TTSSRS0.JCL.CNTL(EMAILTST)
// DD *
--SIMPLE BOUNDARY--
// DD DISP=SHR,DSN=TTSSRS0.JCL.CNTL(EMAILAT)
//
but note that the boundaries are mandatory as specified here -- you cannot skip one and expect multiple attachments to work.
Re: Sending Email from JCL
Posted:
Wed May 05, 2010 11:47 pm
by sdc872
Okay thank you. I'll try this and will let you know how it works. Thank you very much for your prompt response!
Re: Sending Email from JCL
Posted:
Thu May 06, 2010 12:29 am
by sdc872
Robert Sample wrote:Yes, using MIME allows for multiple attachments. This is input into an IEBGENER that copies it to our SMTP output and it delivers multiple attachments:
//SYSUT1 DD *
HELO MAINFRAME.xxxxxxxx.COM
MAIL FROM: <MAINFRAME@xxxxxxxx.COM>
RCPT TO: <RSAMPLE@xxxxxxxx.COM>
DATA
FROM: MAINFRAME@xxxxxxxx.COM
TO: ROBERT.SAMPLE@xxxxxxxx.COM
SUBJECT: TEST ATTACHMENT
MIME-VERSION: 1.0
CONTENT-TYPE: MULTIPART/MIXED; BOUNDARY="SIMPLE BOUNDARY"
--SIMPLE BOUNDARY
CONTENT-TYPE: TEXT/PLAIN
CONTENT-DISPOSITION: ATTACHMENT; FILENAME=EMAILATT.TXT
// DD DISP=SHR,DSN=TTSSRS0.JCL.CNTL(EMAILATT)
// DD *
--SIMPLE BOUNDARY
CONTENT-TYPE: TEXT/PLAIN
CONTENT-DISPOSITION: ATTACHMENT; FILENAME=EMAILTST.TXT
// DD DISP=SHR,DSN=TTSSRS0.JCL.CNTL(EMAILTST)
// DD *
--SIMPLE BOUNDARY--
// DD DISP=SHR,DSN=TTSSRS0.JCL.CNTL(EMAILAT)
//
but note that the boundaries are mandatory as specified here -- you cannot skip one and expect multiple attachments to work.
It's not working for me. What's this line of code:
// DD DISP=SHR,DSN=TTSSRS0.JCL.CNTL(EMAILAT)
I'm not sure what I'm supposed to put here.
Re: Sending Email from JCL
Posted:
Thu May 06, 2010 12:33 am
by Robert Sample
That is the member containing one line with a period in column 1. This is required by the SMTP RFC standard and is not optional.
Re: attach multiple files (10) in one e-mail
Posted:
Thu May 06, 2010 1:00 am
by sdc872
I created a file EMAILAT with a "." in Column 1 and added that to the last line in my code. Now I'm getting this error message:
WER171A CONCAT DS, LRECLS NE OR RECFMS DIFF
EXPLANATION: One of the files concatenated to a fixed-length input
data set has an LRECL not equal to the original LRECL; or one of the
files concatenated to a variable-length data set has an LRECL
greater than the original LRECL; or one of the files concatenated to
a fixed or variable-length data set has a RECFM not equal to the
original RECFM.
I looked it up and got the above description. I don't know what I'm doing wrong. Both of my files have an LRECL of 132.
Re: attach multiple files (10) in one e-mail
Posted:
Thu May 06, 2010 1:04 am
by Robert Sample
Your easiest solution is to create a PDS of LRECL 132, create a member in it for each DD * in my JCL, and concatenate the various members instead of using DD *. Inline data is usually LRECL 80 which would not match your files.
Re: attach multiple files (10) in one e-mail
Posted:
Thu May 06, 2010 1:11 am
by sdc872
Here is my code now:
//SENDNOTE EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT2 DD SYSOUT=(B,SMTP)
//SYSIN DD DUMMY
//SYSUT1 DD *,LRECL=132
HELO SYSA
MAIL FROM:<SDC@XYZ.COM>
RCPT TO:<SDC@XYZ.COM>
DATA
FROM: SDC@XYZ.COM
TO: SDC@XYZ.COM
SUBJECT: COLLECTED FEES REPORT APRIL 2010
MIME-VERSION: 1.0
CONTENT-TYPE: MULTIPART/MIXED; BOUNDARY="SIMPLE BOUNDARY"
--SIMPLE BOUNDARY
CONTENT-TYPE: RICH/TEXT
CONTENT-DISPOSITION: ATTACHMENT; FILENAME=TEST.REPORT1.DOC
// DD DISP=SHR,DSN=TEST.REPORT1.M0410
// DD *
--SIMPLE BOUNDARY
CONTENT-TYPE: RICH/TEXT
CONTENT-DISPOSITION: ATTACHMENT; FILENAME=TEST.REPORT2.DOC
// DD DISP=SHR,DSN=TEST.REPORT2.M0410
// DD *
--SIMPLE BOUNDARY--
// DD DISP=SHR,DSN=TEST.JCL(EMAILAT)
//
Re: attach multiple files (10) in one e-mail
Posted:
Thu May 06, 2010 1:34 am
by sdc872
Robert Sample wrote:Your easiest solution is to create a PDS of LRECL 132, create a member in it for each DD * in my JCL, and concatenate the various members instead of using DD *. Inline data is usually LRECL 80 which would not match your files.
Okay I'll try this. Sorry, this is all new to me, thank you for your patience. I can get it to attach one word document, so I didn't think it would be this hard to attach more than one. Thanks again!