|
View previous topic :: View next topic
|
| Author |
Message |
Srinivas LKP
New User
Joined: 21 Oct 2013 Posts: 4 Location: India
|
|
|
|
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 |
|
 |
Akatsukami
Global Moderator

Joined: 03 Oct 2009 Posts: 1787 Location: Bloomington, IL
|
|
|
|
| With what do you need assistance? |
|
| Back to top |
|
 |
Srinivas LKP
New User
Joined: 21 Oct 2013 Posts: 4 Location: India
|
|
|
|
Hi,
If this will solve with JCL then it is fine. Else tell me with program. |
|
| Back to top |
|
 |
Robert Sample
Global Moderator

Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
| What do you know about SMTP at your site? |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
 |
madprasy
New User

Joined: 08 Apr 2008 Posts: 34 Location: Chennai
|
|
|
|
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 |
|
 |
Robert Sample
Global Moderator

Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
| 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 |
|
 |
madprasy
New User

Joined: 08 Apr 2008 Posts: 34 Location: Chennai
|
|
|
|
| Thanks Robert. Noted. |
|
| Back to top |
|
 |
Srinivas LKP
New User
Joined: 21 Oct 2013 Posts: 4 Location: India
|
|
|
|
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 |
|
 |
Anuj Dhawan
Superior Member

Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
| 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 |
|
 |
Srinivas LKP
New User
Joined: 21 Oct 2013 Posts: 4 Location: India
|
|
|
|
| Yup its resolved now...!!! |
|
| Back to top |
|
 |
|
|