Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to send an email using jcl and program

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
Srinivas LKP

New User


Joined: 21 Oct 2013
Posts: 4
Location: India

PostPosted: Mon Oct 21, 2013 11:44 pm    Post subject: How to send an email using jcl and program
Reply with quote

Hi,
My requirement is job will call a program. The program will query a table and if sql code is 100 then a email should be sent saying "No records for criteria" else if sql code is 0 then nothing should be sent.

Now, Please advise how to code this?
Back to top
View user's profile Send private message

Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Tue Oct 22, 2013 12:00 am    Post subject:
Reply with quote

With what do you need assistance?
Back to top
View user's profile Send private message
Srinivas LKP

New User


Joined: 21 Oct 2013
Posts: 4
Location: India

PostPosted: Tue Oct 22, 2013 12:09 am    Post subject: Reply to: How to send an email using jcl and program
Reply with quote

Hi,
If this will solve with JCL then it is fine. Else tell me with program.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7914
Location: Bellevue, IA

PostPosted: Tue Oct 22, 2013 12:10 am    Post subject:
Reply with quote

What do you know about SMTP at your site?
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Oct 22, 2013 1:06 am    Post subject:
Reply with quote

Hello and welcome to the forum,

Said differently - suggest you speak with your support people and learn how a batch job may send an e-mail on your system.
Back to top
View user's profile Send private message
madprasy

New User


Joined: 08 Apr 2008
Posts: 31
Location: Chennai

PostPosted: Tue Oct 22, 2013 10:37 am    Post subject:
Reply with quote

Hi Srinivas LKP,

I don't feel sending a email from a COBOL program is much feasible. Instead, you can capture those records[sqlcode=100] in a file.. kinda exception file and then feed this file in the next step for SMTP.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7914
Location: Bellevue, IA

PostPosted: Tue Oct 22, 2013 3:13 pm    Post subject:
Reply with quote

madprasy, sending an email from a COBOL program is actually quite easy. Allocate a file where the JCL DD statement points to the SMTP task in the system; open the file for output; write the lines of the email along with the SMTP headers and the trailer data; close the file. And the email gets sent. Any competent COBOL programmer could add this to a program in less than half a day including testing.
Back to top
View user's profile Send private message
madprasy

New User


Joined: 08 Apr 2008
Posts: 31
Location: Chennai

PostPosted: Wed Oct 23, 2013 10:25 am    Post subject:
Reply with quote

Thanks Robert. Noted.
Back to top
View user's profile Send private message
Srinivas LKP

New User


Joined: 21 Oct 2013
Posts: 4
Location: India

PostPosted: Wed Oct 23, 2013 11:32 pm    Post subject: Reply to: How to send an email using jcl and program
Reply with quote

In Program I checked the row count
if count > 0
move yes to indicator
else
move no to indicator

move indicator to ind-field of output-view

overlay output-view to dcb of write-view

if indicator = yes then
write record to file
else
return

----------------------

In job I checked the return code of file is 4 then send E-mail else not.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Wed Oct 30, 2013 3:32 pm    Post subject: Re: Reply to: How to send an email using jcl and program
Reply with quote

Srinivas LKP wrote:
In job I checked the return code of file is 4 then send E-mail else not.
Does that mean it's resolved now, the way you needed it?
Back to top
View user's profile Send private message
Srinivas LKP

New User


Joined: 21 Oct 2013
Posts: 4
Location: India

PostPosted: Wed Oct 30, 2013 10:59 pm    Post subject:
Reply with quote

Yup its resolved now...!!!
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts I can not compile my program PL1 V3.R... Miguel Fernandez PL/I & Assembler 13 Tue Dec 06, 2016 8:30 pm
No new posts IMS BMP program causes 878 system abend Artemk IMS DB/DC 7 Tue Nov 22, 2016 8:26 pm
No new posts A sample of exit program for exit XMN... lind sh CICS 2 Mon Oct 03, 2016 5:07 pm
No new posts Need points to tune IMS Checkpoint Pr... satish.ms10 IMS DB/DC 2 Fri Sep 30, 2016 4:12 pm
No new posts ISPF program to set SCRNAME prino TSO/ISPF 5 Fri Sep 30, 2016 2:18 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us