attach multiple files (10) in one e-mail



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

attach multiple files (10) in one e-mail

Postby sdc872 » Wed May 05, 2010 11:02 pm

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.....
sdc872
 
Posts: 6
Joined: Wed May 05, 2010 10:57 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Sending Email from JCL

Postby Robert Sample » Wed May 05, 2010 11:37 pm

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.
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: Sending Email from JCL

Postby sdc872 » Wed May 05, 2010 11:47 pm

Okay thank you. I'll try this and will let you know how it works. Thank you very much for your prompt response!
sdc872
 
Posts: 6
Joined: Wed May 05, 2010 10:57 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Sending Email from JCL

Postby sdc872 » Thu May 06, 2010 12:29 am

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.
sdc872
 
Posts: 6
Joined: Wed May 05, 2010 10:57 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Sending Email from JCL

Postby Robert Sample » Thu May 06, 2010 12:33 am

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.
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: attach multiple files (10) in one e-mail

Postby sdc872 » Thu May 06, 2010 1:00 am

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.
sdc872
 
Posts: 6
Joined: Wed May 05, 2010 10:57 pm
Has thanked: 0 time
Been thanked: 0 time

Re: attach multiple files (10) in one e-mail

Postby Robert Sample » Thu May 06, 2010 1:04 am

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.
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: attach multiple files (10) in one e-mail

Postby sdc872 » Thu May 06, 2010 1:11 am

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)                     
//
sdc872
 
Posts: 6
Joined: Wed May 05, 2010 10:57 pm
Has thanked: 0 time
Been thanked: 0 time

Re: attach multiple files (10) in one e-mail

Postby sdc872 » Thu May 06, 2010 1:34 am

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!
sdc872
 
Posts: 6
Joined: Wed May 05, 2010 10:57 pm
Has thanked: 0 time
Been thanked: 0 time


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post