0

I have the following code:

//******************************************
//PROC01   EXEC PGM=IEBGENER                
//SYSIN    DD DUMMY                         
//SYSPRINT DD SYSOUT=*                      
//SYSUT2   DD SYSOUT=(B,SMTP)               
//SYSUT1   DD *                               
RCPT TO:<MAIL@AR.TEST.COM>                
DATA                                                             
SOME TEXT GOES HERE   

Can I attach a dataset/file into the mail? Thanks.

F0l0w
  • 243
  • 5
  • 15
  • Yes it is possible. Gotta leave work though. I do this at work for a couple of jobs. Will get back to you tomorrow if someone else does not. – Squashman Oct 24 '16 at 20:24
  • What happened with your XMIT attempt? Here, did you just try concatenating our dataset to the //SYSUT1 DD? – Bill Woodger Oct 24 '16 at 21:15
  • Both of the previous answers are correct for the syntax of the JCL, however you will need to get with your systems/network people to determine if there is a DEST defined for sending emails and what that DEST is. Your shop might also have a canned email PROC that you can use. – John Coleman Sep 08 '18 at 20:49

2 Answers2

0

Try something like:

//******************************************
//PROC01   EXEC PGM=IEBGENER                
//EMAIL    OUTPUT DEST=EMAIL,
//         USERDATA=('FILENAME:attachment.txt',
//         'TO:<MAIL@AR.TEST.COM>',
//         'FILEDESC:Sent from MVS'),
//         TITLE=('Sent from MVS'),
//         MAILFROM=('<YOURMAIL@AR.TEST.COM>'),
//         REPLYTO=('<YOURMAIL@AR.TEST.COM>')
//SYSIN    DD DUMMY                         
//SYSPRINT DD SYSOUT=*                      
//SYSUT2   DD SYSOUT=Z,OUTPUT=*.EMAIL
//SYSUT1   DD DISP=SHR,DSN=<DSNNAME>

or, if you would like the attachment to be a PDF, something like:

//******************************************
//PROC01   EXEC PGM=IEBGENER                
//EMAIL    OUTPUT DEST=EMAILPDF,
//         USERDATA=('FILENAME:attachment.pdf',
//         'TO:<MAIL@AR.TEST.COM>',
//         'PDFPGSIZ=(826,1169)',
//         'PDFFONT=(COURIER,8)',
//         'FILEDESC:Sent from MVS'),
//         TITLE=('Sent from MVS'),
//         MAILFROM=('<YOURMAIL@AR.TEST.COM>'),
//         REPLYTO=('<YOURMAIL@AR.TEST.COM>')
//SYSIN    DD DUMMY                         
//SYSPRINT DD SYSOUT=*                      
//SYSUT2   DD SYSOUT=Z,OUTPUT=*.EMAIL
//SYSUT1   DD DISP=SHR,DSN=<DSNNAME>

Hope this works for you :)

Remko
  • 359
  • 2
  • 8
0

You should be able to just add card:

// DD DSN=,DISP=SHR

to the end of your existing job. We use this style all the time. Using the OUTPUT card is also an option, as previously noted.

MVSDude
  • 1
  • 1