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 from a COBOL program.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
mkk157

Active User


Joined: 17 May 2006
Posts: 310

PostPosted: Wed Feb 20, 2008 11:15 am    Post subject: How to send an Email from a COBOL program.
Reply with quote

Dear Experts,

My requirement is to send an automatic email to support services by using a new program, when an abend occurs in an existing COBOL-DB2 program.

To be in detailed:

I have a table ABC_LOCATION with the fields location_id, capacity, locaton_name. All are CHAR(3) And the table contains 12 rows as of now.

In my COBOL-DB2 program, I am retrieving the corresponding location_id and capacity depends on location_name coming from a file which is producing by Up-stream system.

There is another table XYZ_LOCATION which is the base table contains many fields includes location_id and locaton_name.

When ever a new location details are added into the table XYZ_location in the upstream system then my program will give an SQLCODE +100 because there is no row correspond to that new location in the table ABC_LOCATION

OfCourse, they need to do the impact analasys and to inform our team to do necessary amendments in our relative tables.

In the worst case scenario, To avoid the abending of the batch job which impacts all other down-stream batches, we are looking for a solution to write a program to send an automatic mail to support services and inform them to insert a new row into the table ABC_LOCATION and then rerun the job again.

Please suggest me the way to do this. I couldn't get any sample program in our system.
Back to top
View user's profile Send private message

shitij

New User


Joined: 09 Sep 2005
Posts: 31
Location: Delhi

PostPosted: Wed Feb 20, 2008 12:54 pm    Post subject: Hi
Reply with quote

Hi mkk,


If i have understood ur problem correctly:

This can very well be done thru JCL itself (and making a minor change in ur current program)...Now whenever there is a new location thats currently not existing i.e. SQLCODE = 100...after SQLCODE=100 set a RETURN-CODE in the program to end ur pgm with ur desired choice of return code (that indicates a new entry is reqd...say may be return code of 88 or 99).

Once u get ur desired return code...in the jcl after the step which runs ur pgm add a new step that will run only if the previous return code is 88 or 99 (or whatever return code u wanted).

Pls note that this additional step would be a SMTP mail step that would send the mailer to all the reqd users...SMTP step i think u can easily get by following few SMTP jcl's in ur system.

I hope this might help u.

Regards,
Shitij
Back to top
View user's profile Send private message
mkk157

Active User


Joined: 17 May 2006
Posts: 310

PostPosted: Wed Feb 20, 2008 1:15 pm    Post subject: Hi
Reply with quote

But shitij,

Thanks for ur reply.

I can get sample SMTP JCL from our system

To achieve this I need to make the content of the mail with the Location_id and capacity values which are coming from an upstream system file.
To do this, I need to amend the existing program, with some piece of code to retrieve and store those values as a content of the mail.

How should I proceed to achieve this with the help of a new program without amending the actual program .
Back to top
View user's profile Send private message
shitij

New User


Joined: 09 Sep 2005
Posts: 31
Location: Delhi

PostPosted: Wed Feb 20, 2008 2:41 pm    Post subject: Hi
Reply with quote

Hi MKK,

I think u can send the content of a file via SMTP mail job (that is the contents stored in the new file which u will make)...actually i dont have any sample SMTP job to refer right now but i am +ve that contents of a file could be sent via mail.

All u need to do is write the info required to a new file (in ur existing pgm itself) and use that file as a part of SMTP step added.

Say the new file says:

"This is to inform you that WS-LOCATION-ID and WS-CAPACITY-VAL1, WS-CAPACITY-VAL2, WS-CAPACITY-VAL3 was missing in XXX Table and should be added to ASAP"

U can fill the WS- variables with the known value and write the file to a mail.


So a new file in ur present jobstep and this new file in the next SMTP step.

Hope i understood what u wanted.


Regards,
Shitij
Back to top
View user's profile Send private message
shitij

New User


Joined: 09 Sep 2005
Posts: 31
Location: Delhi

PostPosted: Wed Feb 20, 2008 3:19 pm    Post subject: Sample SMTP job
Reply with quote

Code:
//*=========================================
//**  SENDS E-MAIL TO ALL USERS DURING EXCEPTIONS       **
//*=========================================
//SENDNOTE EXEC PGM=IEBGENER,COND=(99,NE,STEP00X)
//SYSIN    DD DUMMY
//SYSPRINT DD SYSOUT=(,),OUTPUT=(*.SITE)
//SYSUT2   DD SYSOUT=(B,SMTP)
//SYSUT1   DD DSN=LIBNAME(MWMAILHR),DISP=SHR
//         DD DSN=NEWFILENAME(+1),DISP=SHR
//         DD DSN=LIBNAME(MWMAILTR),DISP=SHR
//*


Here is the sample SMTP job i was telling u about.


Regards,
Shitij
Back to top
View user's profile Send private message
mkk157

Active User


Joined: 17 May 2006
Posts: 310

PostPosted: Wed Feb 20, 2008 3:41 pm    Post subject:
Reply with quote

Thanks Shitji,

Its very helpful for me.
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts RULES(NOEVENPACK) in cobol jackzhang75 COBOL Programming 5 Wed Mar 29, 2017 12:47 am
No new posts how to send just 10 rows in a CICS sc... Megha Gupta CICS 5 Thu Feb 23, 2017 6:57 pm
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm
No new posts Execute TSO ACF commands from COBOL-I... supreethi.srid TSO/ISPF 0 Tue Feb 21, 2017 5:19 pm
No new posts Mainframe Interview Questions CICS,CO... akshathan Mainframe Interview Questions 6 Thu Feb 09, 2017 6:38 pm


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