IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to send an email using jcl and program


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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: 1788
Location: Bloomington, IL

PostPosted: Tue Oct 22, 2013 12:00 am
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
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: 8697
Location: Dubuque, Iowa, USA

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

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

Moderator Emeritus


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

PostPosted: Tue Oct 22, 2013 1:06 am
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: 34
Location: Chennai

PostPosted: Tue Oct 22, 2013 10:37 am
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: 8697
Location: Dubuque, Iowa, USA

PostPosted: Tue Oct 22, 2013 3:13 pm
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: 34
Location: Chennai

PostPosted: Wed Oct 23, 2013 10:25 am
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
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

Superior Member


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

PostPosted: Wed Oct 30, 2013 3:32 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Using API Gateway from CICS program CICS 0
No new posts DB2 Event passed to the Application P... DB2 1
No new posts How to pass the PARM value to my targ... COBOL Programming 8
No new posts REXX code to expand copybook in a cob... CLIST & REXX 2
No new posts EZT program to build a flat file with... All Other Mainframe Topics 9
Search our Forums:

Back to Top