Sending an Email from JCL with attachment

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

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

Post by Natarajan » Tue Apr 14, 2009 4:26 pm

Welcome. :)
Natarajan
Chennai

srinut123
Member
Posts: 1
Joined: Wed Jun 10, 2009 9:56 pm

Post by srinut123 » Wed Jun 10, 2009 10:04 pm

Hi
From the above examples, can i make the file name as dynamic? I want the file name to be date_time_XYZZ.txt (where date= current date and time = current time) instead of just XYZZ.txt

Please suggest
thanks

MrSpock
Active Member
Posts: 273
Joined: Wed Jun 27, 2007 5:37 pm

Post by MrSpock » Thu Jun 11, 2009 1:46 am

Well, you control the code that specifies what the target attachment filename is, so yes, you can use any name you want. Just choose the program/utility you wish to use to generate the date/time values, and plug them into the data where appropriate.

Nair47
Member
Posts: 1
Joined: Sat Jun 13, 2009 5:56 pm

email from mainframe

Post by Nair47 » Sat Jun 13, 2009 6:02 pm

hi,
Iam new to mainframes.....when iam trying to execute a jcl which sends mail ...iam getting maxcc=0 but mail is not been sent.....can any one please tell me wat wrong??? any please tell me wat actually mean HELO *********and wat should i mention after HELO.

//******* JOB ,,NOTIFY=&SYSUID,CLASS=B,MSGLEVEL=(1,1),MSGCLASS=X
//IEBGENER EXEC PGM=IEBGENER
//SYSIN DD DUMMY
//SYSPRINT DD SYSOUT=*
//SYSUT2 DD SYSOUT=(B,SMTP)
//SYSOUT DD SYSOUT=*
//SYSUT1 DD *
HELO **************
MAIL FROM :<mail id 1>
RCPT TO :<mail id 2>
DATA
FROM :<mail id 1>
TO :<mail id 2>
SUBJECT:TEST
HI..... WAT DOING?
REGARDS,
RAJESH
/*
thanks,
Rajesh

aralikattirigvedi
Member
Posts: 3
Joined: Wed Jul 15, 2009 3:18 pm

Erroneous data

Post by aralikattirigvedi » Thu Jul 16, 2009 5:05 pm

Hi All,

I am trying to send an attachment through Mainframes.

I followed the procedure as mentioned by "snatcher".

But I am getting the following error. Is the data at the end in the file erroneous? If yes how to eliminate it. thanks for ur help
1

Unable to deliver mail to some/all recipients.
050 DATA 00000400501 Syntax Error. No Args after 'DATA' command
050 FROM:<abc@xyz.COM> 00000500
regards
aralikatti

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

Post by Natarajan » Thu Jul 16, 2009 5:17 pm

It look like there is sytax error i.e, required data is missing.
Natarajan
Chennai

aralikattirigvedi
Member
Posts: 3
Joined: Wed Jul 15, 2009 3:18 pm

Post by aralikattirigvedi » Fri Jul 17, 2009 1:43 pm

All, Just wanted to brief more as i am not getting resolution yet. PLZ reply.

Jcl:

//ATTHMAL JOB (,24),,CLASS=Y,MSGCLASS=A,NOTIFY=&SYSUID
//STEPMX05 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSIN DD DUMMY
//SYSOUT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=D
//SYSUT2 DD SYSOUT=(B,SMTP)
//SYSUT1 DD DSN=EMAIL.TEST.HELLO,DISP=SHR
// DD DSN=EMAIL.TEST.CODE,DISP=SHR
// DD DSN=EMAIL.TEST.TEXT,DISP=SHR

EMAIL.TEST.HELLO:
HELO JESsmtp
mail from:<XYZ@ABC.COM>
rcpt to:<PQR@ABC.COM>
DATA
FROM: :<XYZ@ABC.COM>
TO: :<XYZ@ABC.COM>
Subject: Test attachment

EMAIL.TEST.CODE:--MIME
CONTENT-TYPE: TEXT/PLAIN;NAME=RECY.TXT
CONTENT-TRANSFER-ENCODING: 7BIT
CONTENT-DISPOSITION: ATTACHMENT;
FILENAME=RECY.TXT;

EMAIL.TEST.TEXT: Is my attachment.

Is there any flaw in the code? My files are having same DCB?s. LRECl=80. But there is some number like 00000100 from col 73. Is this the error if so how to turn it off?

The error message is

Unable to deliver mail to some/all recipients.
050 data 00000500
501 Syntax Error. No Args after 'data' command.

Sorry for the big notes!
regards
aralikatti

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

Post by Natarajan » Mon Jul 20, 2009 12:45 pm

aralikattirigvedi wrote:

EMAIL.TEST.HELLO:
HELO JESsmtp
mail from:<XYZ@ABC.COM>
rcpt to:<PQR@ABC.COM>
DATA
FROM: :<XYZ@ABC.COM>
TO: :<XYZ@ABC.COM>
Subject: Test attachment
two : ( colons ) after FROM , TO might be giving error.
please check.
Natarajan
Chennai

aralikattirigvedi
Member
Posts: 3
Joined: Wed Jul 15, 2009 3:18 pm

Post by aralikattirigvedi » Mon Jul 20, 2009 3:56 pm

Thanks a lot Nataraj. I also removed some erroneous data which was @ the end.

Amazingly now I got the email, text in the body of email and an attachment with correct data.

This is a great team!
regards
aralikatti

User avatar
Priyadarshan
Member
Posts: 3
Joined: Wed Apr 26, 2006 4:53 pm
Location: Bangalore, India

Post by Priyadarshan » Wed Sep 09, 2009 5:02 pm

Hi Subasu / Natarajan,

Are there any limitations on the file size when we try for attachements as well as some text in the mail?

My data size is 100 bytes and I am not able to have both - some text in the body of the mail and the data to be sent as attachment.

Priyadarshan
'There are two choices in life-Take it or leave it !' Deb Ben

raghukishore
Member
Posts: 1
Joined: Fri Sep 11, 2009 12:24 pm
Location: chennai

Post by raghukishore » Fri Sep 11, 2009 12:30 pm

Hi All,

I am new to Mainframes and i am a learner .

Before posting my Requirement,I tried all the Code Samples Provided in the discussion,

But i didnot find any Solution for the Requirement like sending multiple [say 5 files] as attachements to the mails.

Kindly Provide me an appropriate steps that are to be coded so as to send
5 mainframe files as attachements

thanks
Kishore P.N.R

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

Post by Natarajan » Sat Sep 12, 2009 11:07 am

Can you able to send the mail witout attachment?
Natarajan
Chennai

bharani
Member
Posts: 13
Joined: Fri Oct 09, 2009 2:47 am

Post by bharani » Sat Oct 17, 2009 1:44 am

Hi sending multiple attachment is not working, the attachment is comming inside the mailitself, any one please help me, it is very urgent and important for me to finish it.

if you can please give the working code please........

thanks in advance.

bharani
Member
Posts: 13
Joined: Fri Oct 09, 2009 2:47 am

Post by bharani » Sat Oct 17, 2009 2:22 am

Main Job
*************
//SETP01 EXEC PGM=IEBGENER
//SYSIN DD DUMMY
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=D
//SYSUT2 DD SYSOUT=(B,SMTP)
//SYSUT1 DD DSN=XXXXX.MAIL.HEADER,DISP=SHR
// DD DSN=XXXXX.MAIL.ATTACH1,DISP=SHR
// DD DSN=XXXXX.MAIL.REPORT1,DISP=SHR
// DD DSN=XXXXX.MAIL.ATTACH2,DISP=SHR
// DD DSN=XXXXX.MAIL.REPORT2,DISP=SHR
/*

XXXXX.MAIL.HEADER :

HELO GECC.2
MAIL FROM:<bharani.s@xxx.com>
RCPT TO:<bharani.s@xxx.com>
DATA
FROM:<bharani.s@xxx.com>
TO:<bharani.s@xxx.com>
Subject: Test attachment


XXXXX.MAIL.ATTACH1 :
--MIME
CONTENT-TYPE: TEXT/PLAIN;NAME=RECY1.TXT
CONTENT-TRANSFER-ENCODING: 7BIT
CONTENT-DISPOSITION: ATTACHMENT;
FILENAME=RECY1.TXT;

XXXXX.MAIL.ATTACH2 :
--MIME
CONTENT-TYPE: TEXT/PLAIN;NAME=RECY2.TXT
CONTENT-TRANSFER-ENCODING: 7BIT
CONTENT-DISPOSITION: ATTACHMENT;
FILENAME=RECY2.TXT;

XXXXX.MAIL.REPORT1 and XXXXX.MAIL.REPORT2 are the attachments, all are with the same DCB. LREC 80.

Can any one please help me....... i need it very urgently and its very important. please.......... Thanks in Advance.

glachapel
Member
Posts: 1
Joined: Thu Oct 29, 2009 8:34 pm

Sending an Email from JCL with attachment

Post by glachapel » Tue Nov 03, 2009 1:22 am

Using IEBGENER I did get the examples to work, my question is where can I find the manual that has the SMTP commands syntax.

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