How to send mail having some content of the file via jcl

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
avishekinfy26
Member
Posts: 4
Joined: Tue Apr 20, 2010 1:44 pm

How to send mail having some content of the file via jcl

Post by avishekinfy26 » Wed Apr 21, 2010 9:52 am

I am using IEBGENER to send mail
//RCOUTBAL EXEC PGM=IEBGENER,TIME=&TIM
//SYSIN DD DUMMY
//SYSUT1 DD DSN=XXX.FILE,DISP=SHR
//SYSUT2 DD SYSOUT=(B,SMTP),RECFM=FB
//SYSPRINT DD SYSOUT=*

Contents of XXX.FILE:
HELO SYSA
MAIL FROM:<xxx@gmail.com>
RCPT TO:<yyy@gmail.com>
DATA
SUBJECT: XXXX

Body of the mail

I am getting mail successfully.
Now I want to send a report file that was generating a step earlier as attachment or printing the content of the report file into body of my mail.
Anyone of this will work for me.
Report file is a GDG
Please help me .I am new to mainframe

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

Post by Anuj Dhawan » Wed Apr 21, 2010 1:09 pm

Please check this link.
Regards,
Anuj

avishekinfy26
Member
Posts: 4
Joined: Tue Apr 20, 2010 1:44 pm

Post by avishekinfy26 » Wed Apr 21, 2010 4:33 pm

I am solve the problem of the attachment:
//SENDMAIL EXEC PGM=IEBGENER
//SYSIN DD DUMMY
//SYSPRINT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSUT2 DD SYSOUT=(O,SMTP) (O-Sysout class)
//SYSUT1 DD DISP=SHR,DSN=TEST1.DATA(XXXX)
// DD DISP=SHR,DSN=TEST2.DATA

TEST2.DATA is my file to be attached.
TEST1.DATA is my control card having parameters:
helo XXXXXXX
mail from:<xxxxxxxx@yyyy.com>
rcpt to:<xxxxxxxx@yyyy.com>
data
from: xxxxxxxx@yyyy.com
to: xxxxxxxx@yyyy.com
SUBJECT: TEXT FILE
MIME-VERSION: 1.0
CONTENT-TYPE: MULTIPART/MIXED;BOUNDARY="BOUNDARY"

--BOUNDARY
CONTENT-TYPE: TEXT/PLAIN; CHARSET=US-ASCII
CONTENT-TRANSFER-ENCODING: 7BIT

The text file attached

--BOUNDARY
CONTENT-TYPE: TEXT/PLAIN;NAME:REPORT.TXT;CHARSET=US-ASCII
CONTENT-TRANSFER-ENCODING: 7BIT
CONTENT-DISPOSITION: ATTACHMENT;FILENAME=REPORT.txt

But the problem is that when I tried to put those commands in ps file of LRECL 600
the mail is going.Can anyone explain why?

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

Post by Anuj Dhawan » Thu Apr 22, 2010 12:30 pm

avishekinfy26 wrote:But the problem is that when I tried to put those commands in ps file of LRECL 600 the mail is going.Can anyone explain why?
I'm not sure if I understood your problem - if mail is "going" well, what else you're looking for?
Regards,
Anuj

avishekinfy26
Member
Posts: 4
Joined: Tue Apr 20, 2010 1:44 pm

Post by avishekinfy26 » Mon Apr 26, 2010 3:25 pm

Sorry for the typo!!!Now my requirement got changed.
I want to print the file content in the body of the mail and send mail.
Please let me know whether it is possible or not?

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

Post by Anuj Dhawan » Mon Apr 26, 2010 4:57 pm

Regards,
Anuj

Aradhana
Member
Posts: 1
Joined: Sun Aug 04, 2013 9:17 pm

Post by Aradhana » Sun Aug 04, 2013 9:22 pm

Hi,

As suggested I wrote a jcl :-

//HRECALL JOB (ACCOUNT),'HRECALL',CLASS=A,
// MSGCLASS=D,REGION=32M,NOTIFY=PPPRG2
//E16LIB JCLLIB ORDER=WEPLD.PROD.PROCLIB
//***********************************************
//RCOUTBAL EXEC PGM=IEBGENER
//SYSIN DD DUMMY
//SYSUT1 DD DSN=PPPRG2.MIGRATE.MSGS05,DISP=SHR
//SYSUT2 DD SYSOUT=(B,SMTP),RECFM=F
//SYSPRINT DD SYSOUT=*


PPPRG2.MIGRATE.MSGS05 contains :-


ssssssssssssssssssssssssssssssssssssssssssssss
PPPRG2.MIGRATE.MSGS05
d ===>
***************************** Top of Data ***
HELO SYSA
MAIL FROM:<XXX@XXX.COM>
RCPT TO:<XXX@XXX.COM>
DATA
SUBJECT: JCL MAIL
BODY OF THE MAIL
**************************** Bottom of Data *

xxx stands for mail id.

I ran this job and got maxcc=0, but mail was not received.
Please advice how to send mail.

Thanks,
Aradhana

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

Post by NicC » Mon Aug 05, 2013 12:20 pm

1) Suggest yo do NOT tailgate old topics. Stsrt a new one and reference the old one
2) Do not multi-post across forums
3) Why do you call your JOB HRECALL which was obviously the name given to a job to do and HSM task?
4) Why call your dataset ...MIGRATE... when it has nothing to do with an HSM task?
5) as I mentioned in my reply on another forum - speak to the people who know within your organisation.
Regards
Nic

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