Sending an attachment with email using JCL job

In this Mainframe Forum - You can post your queries on JCL, OS/390 JCL, MVS JCL, z/OS JCL, JES2 & JES3

Moderators: Frank Yaeger, DikDude, Moderator Group

Post Reply
sampada
Member
Posts: 1
Joined: Wed Oct 22, 2008 11:40 am

Sending an attachment with email using JCL job

Post by sampada » Wed Oct 22, 2008 12:23 pm

Hi All,
I have created a job which sends a report file as an attchment with the mail. The attachemnt is a text file having size around 1 to 1.5MB. When I submit the job, S722 abend is coming but mail is also getting sent with truncated file in the attachment :roll: . I have tried many things to increase possible size of the attachement I can send with tha mail, but not succeded. Can anyone help me in this?

-Sampada

User avatar
Natarajan
Moderator
Posts: 537
Joined: Fri Oct 10, 2008 12:57 pm
Location: chennai
Contact:

Post by Natarajan » Wed Oct 22, 2008 12:32 pm

Can you give details of what program you are using to send mail.
give step details.
Natarajan
Chennai

Anuj Dhawan
Moderator
Posts: 1625
Joined: Sat Aug 09, 2008 9:02 am
Location: Mumbai, India

Post by Anuj Dhawan » Sun Nov 23, 2008 9:31 am

Hi,

This code sends the data as a text attachment:

Code: Select all

//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&#58; <MAINFRAME@********> 
RCPT TO&#58; <Anuj@********> 
DATA 
FROM&#58;     MAINFRAME@******** 
TO&#58;       Anuj  
SUBJECT&#58;  TEST ATTACHMENT 
MIME-VERSION&#58; 1.0 
CONTENT-TYPE&#58; TEXT/PLAIN 
CONTENT-DISPOSITION&#58; ATTACHMENT; FILENAME=FILE.TXT 
//       DD DSN=XXXXXX.JCL.CNTL&#40;EMAILATT&#41;,DISP=SHR 
//       DD DSN=XXXXXX.JCL.CNTL&#40;EMAILAT&#41;,DISP=OLD
Regards,
Anuj

udaya00
Member
Posts: 6
Joined: Wed Apr 08, 2009 9:46 am

Post by udaya00 » Tue May 05, 2009 4:18 pm

Hi,
Use dataset for first DD in SYSUT1 instead of instream data.

let me know if any probs
uday

Anuj Dhawan
Moderator
Posts: 1625
Joined: Sat Aug 09, 2008 9:02 am
Location: Mumbai, India

Post by Anuj Dhawan » Wed May 06, 2009 1:53 pm

udaya00 wrote:Use dataset for first DD in SYSUT1 instead of instream data.
What difference does that make?
Regards,
Anuj

upendra_water
Member
Posts: 1
Joined: Wed Nov 25, 2009 11:38 am
Location: India

Post by upendra_water » Wed Nov 25, 2009 9:33 pm

I am facing same problem mentioned above. The attachment is text file of size around 2MB. In my case the job executes successfully but when I get a report it is truncated; I mean many rows from the bottom side are deleted.
I even tried to zip the text file but I am unable to unzip the file when I receive a mail.
What I am looking for is:
a) Is there any way to send files having high size.
b) The correct syntax for zipping the attachment so that there us no problem at user's end while unzipping the file.

Any help in thus regards is highly appriciated.

Srini D
Member
Posts: 1
Joined: Fri Jun 17, 2011 3:19 pm

IEBGENER - jcl to email an attachment

Post by Srini D » Sat Jun 18, 2011 12:58 pm

Hello,

I am trying to email an attachment from mainframe using IEBGENER. My JCL is:
//MAILPROC EXEC PGM=IEBGENER
//SYSABEND DD SYSOUT=*
//SYSTOTAL DD SYSOUT=*
//SYSLIST DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSUT2 DD SYSOUT=(A,SMTP)
//SYSIN DD DUMMY
//*
//SYSUT1 DD DSN=USERID.INPUT.CARDS,DISP=SHR
// DD DSN=USERID.DCOL.DATASETS,DISP=SHR

Content of USERID.INPUT.CARDS is as below:

HELO MAILST1
MAIL FROM: <NAME@COMPANY.COM>
RCPT TO: <NAME@COMPANY.COM>
DATA
FROM: <NAME@COMPANY.COM>
TO: <NAME@COMPANY.COM>
SUBJECT: TEST ATTACHMENT
MIME-VERSION: 1.0
CONTENT-DISPOSITION:ATTACHMENT;FILENAME="TEXT_FILE.TXT"
CONTENT-TYPE: TEXT/PLAIN

This JCL is working well, but if I put some text in the body of the USERID.INPUT.CARDS, I don't get the attachment, instead I get the attachment text in the body of the email.

Any help on getting this work, please?

Thanks,
Srini

Anuj Dhawan
Moderator
Posts: 1625
Joined: Sat Aug 09, 2008 9:02 am
Location: Mumbai, India

Re: IEBGENER - jcl to email an attachment

Post by Anuj Dhawan » Sat Jun 18, 2011 8:10 pm

Srini D wrote:I don't get the attachment, instead I get the attachment text in the body of the email.
Possibly, in your Outlook you are using "Rich-text" or "plain text" format.

Try:

1. From the main Outlook window, on the Tools menu, click Options, and then click the Mail Format tab.
2. Click Internet Format.
3. Under Outlook Rich Text options, select the HTML format.
Regards,
Anuj

naga821
Member
Posts: 1
Joined: Mon Jun 02, 2014 9:54 pm

Re: IEBGENER - jcl to email an attachment

Post by naga821 » Mon Jun 02, 2014 9:56 pm

Srini D wrote:Hello,

I am trying to email an attachment from mainframe using IEBGENER. My JCL is:
//MAILPROC EXEC PGM=IEBGENER
//SYSABEND DD SYSOUT=*
//SYSTOTAL DD SYSOUT=*
//SYSLIST DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSUT2 DD SYSOUT=(A,SMTP)
//SYSIN DD DUMMY
//*
//SYSUT1 DD DSN=USERID.INPUT.CARDS,DISP=SHR
// DD DSN=USERID.DCOL.DATASETS,DISP=SHR

Content of USERID.INPUT.CARDS is as below:

HELO MAILST1
MAIL FROM: <NAME@COMPANY.COM>
RCPT TO: <NAME@COMPANY.COM>
DATA
FROM: <NAME@COMPANY.COM>
TO: <NAME@COMPANY.COM>
SUBJECT: TEST ATTACHMENT
MIME-VERSION: 1.0
CONTENT-DISPOSITION:ATTACHMENT;FILENAME="TEXT_FILE.TXT"
CONTENT-TYPE: TEXT/PLAIN

This JCL is working well, but if I put some text in the body of the USERID.INPUT.CARDS, I don't get the attachment, instead I get the attachment text in the body of the email.

Any help on getting this work, please?

Thanks,
Srini
Hi,
I am using same code, My JCL ran successfully but I did not get any mail. Please advice.

Thanks,
naga.

NicC
Active Member
Posts: 650
Joined: Sun Jul 24, 2011 5:27 pm
Location: Down on the pig farm

Post by NicC » Thu Jun 05, 2014 1:00 pm

1) you should strt a new topic - you can cross-reference it to this.
2) If you used that exact code then it is no wonder that you did not get an email unless your email address really is name@company.com and your file name really is text_file.txt
3) Have you checked with your systems group that A,SMTP is the correct class and process for emailing at your shop?
Regards
Nic

academyindia4

Topic deleted by Admin

Post by academyindia4 » Wed Feb 03, 2016 12:51 am

<< Content deleted By Admin >>

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others