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
 

 

SMTP email through TDQ

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CICS
View previous topic :: :: View next topic  
Author Message
valyk

Active User


Joined: 16 Apr 2008
Posts: 104
Location: South Carolina

PostPosted: Wed Mar 30, 2011 7:51 pm    Post subject: SMTP email through TDQ
Reply with quote

I am writing to a TDQ that is allocated like the following:

Code:
 TDqueue        : SMTP
 Group          : MYGROUP
 DEscription    :
 TYPE           : Extra              Extra | INTra | INDirect
EXTRA PARTITION PARAMETERS
 DAtabuffers    : 001                1-255
 DDname         : MAIL
 DSname         :
 Sysoutclass    :
 Erroroption    : Ignore             Ignore | Skip
 Opentime       : Initial            Initial | Deferred
 REWind         :                    Leave | Reread
 TYPEFile       : Output             Input | Output | Rdback
 RECORDSize     : 00080              0-32767
 BLOCKSize      :                    0-32767
 RECORDFormat   : Fixed              Fixed | Variable
 BLOCKFormat    : Blocked            Blocked | Unblocked
 Printcontrol   :                    A | M
 DIsposition    : Shr                Shr | Old | Mod


This is how the MAIL DD is allocated:

Code:
//MAIL     DD  SYSOUT=(B,SMTP)


I write to the TDQ, my task ends, but the email does not send. I closed the TDQ, but it still does not send. The email is finally sent when the region is shut down.

This is what I am writing:

Code:
HELO MY.MAIL.SERVER.COM
MAIL FROM:<CICS@.MY.MAIL.SERVER.COM>
RCPT TO:<ME@MY.MAIL.SERVER.COM>
DATA
TO:   <ME@MY.MAIL.SERVER.COM>
FROM: <CICS@MY.MAIL.SERVER.COM>
SUBJECT:  TEST SMTP MESSAGES
THIS IS A TEST


I tried appending 'QUIT', but it just treated it like a string in the body of the email.
Back to top
View user's profile Send private message

superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Wed Mar 30, 2011 8:02 pm    Post subject: Reply to: SMTP email through TDQ
Reply with quote

Where's the period? And yes, you need QUIT as well.

See this example or read up on how to properly code for the SMTP protocol.
Back to top
View user's profile Send private message
valyk

Active User


Joined: 16 Apr 2008
Posts: 104
Location: South Carolina

PostPosted: Wed Mar 30, 2011 8:11 pm    Post subject:
Reply with quote

Ok. Now my SMTP string looks like the following:

Code:
HELO MY.MAIL.SERVER.COM
MAIL FROM:<CICS@.MY.MAIL.SERVER.COM>
RCPT TO:<ME@MY.MAIL.SERVER.COM>
DATA
TO:   <ME@MY.MAIL.SERVER.COM>
FROM: <CICS@MY.MAIL.SERVER.COM>
SUBJECT:  TEST SMTP MESSAGES
THIS IS A TEST
.
QUIT


Still no luck...
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1445
Location: Azeroth

PostPosted: Thu Mar 31, 2011 12:06 am    Post subject:
Reply with quote

Hello,

Are you sure that B,SMTP is the right SYSOUT destination?
There was a post few days back which has some information that might help.
http://www.ibmmainframes.com/viewtopic.php?t=53855&highlight=

Hope it helps.
Back to top
View user's profile Send private message
valyk

Active User


Joined: 16 Apr 2008
Posts: 104
Location: South Carolina

PostPosted: Thu Mar 31, 2011 12:30 am    Post subject:
Reply with quote

Yes. My installation uses class B.

The issue is not that the mail is not being delivered. It is making it to the destination, just not when the transaction is being executed.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Thu Mar 31, 2011 12:41 am    Post subject:
Reply with quote

Did you CLOSE the TDQ, or did you CLOSE & DISABLE the TDQ? If the first, I'd try doing both to see if that works. You may need FREE=CLOSE on the DD statement as well.

However, IBM's example of sending email to SMTP from CICS is CA1H (hint: Google is your friend) and CA1H uses the SPOOL commands, not a TDQ. I would consider this a very strong hint that TDQ is probably not the way to go when writing SMTP from CICS.
Back to top
View user's profile Send private message
valyk

Active User


Joined: 16 Apr 2008
Posts: 104
Location: South Carolina

PostPosted: Thu Mar 31, 2011 1:18 am    Post subject:
Reply with quote

Robert Sample wrote:
Did you CLOSE the TDQ, or did you CLOSE & DISABLE the TDQ? If the first, I'd try doing both to see if that works. You may need FREE=CLOSE on the DD statement as well.

However, IBM's example of sending email to SMTP from CICS is CA1H (hint: Google is your friend) and CA1H uses the SPOOL commands, not a TDQ. I would consider this a very strong hint that TDQ is probably not the way to go when writing SMTP from CICS.


I tried all three. I first did a simple close, then close/disable, then later I freed the DD. All three failed to work.

I think I am in agreement with your last sentence. I don't think writing to a TDQ is a supported function for SMTP.

We talked about writing to the spool and creating a job to simply issue the SMTP commands, but that is very convoluted and would be irritating for someone in the future to come across.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Thu Mar 31, 2011 1:22 am    Post subject:
Reply with quote

Quote:
but that is very convoluted
Why? IBM has already written the code in CA1H and it is available for download for free. They even have a sample calling program, written in COBOL, that is used to verify the installation. There's not much more than copying, compiling, and adding some CICS table entries to get that solution up and running.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10203
Location: italy

PostPosted: Thu Mar 31, 2011 1:37 am    Post subject: Reply to: SMTP email through TDQ
Reply with quote

and what about understanding the solution ? icon_wink.gif

Quote:
but that is very convoluted and would be irritating for someone in the future to come across.
Back to top
View user's profile Send private message
Earl Haigh

Active User


Joined: 25 Jul 2006
Posts: 475

PostPosted: Tue Apr 05, 2011 5:30 am    Post subject:
Reply with quote

phew!, I don't understand why some programmers refuse to ask their
co-workers or their Tech Support people for help.

if your environment is setup to do SMTP email from CICS,
then someone in your shop most already know how to do this.
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Tue Apr 05, 2011 5:33 am    Post subject:
Reply with quote

Earl Haigh wrote:
phew!, I don't understand why some programmers refuse to ask their co-workers or their Tech Support people for help.


The poster IS the CICS Systems Programmer.
Back to top
View user's profile Send private message
valyk

Active User


Joined: 16 Apr 2008
Posts: 104
Location: South Carolina

PostPosted: Tue Apr 05, 2011 7:51 am    Post subject:
Reply with quote

Robert Sample wrote:
Quote:
but that is very convoluted
Why? IBM has already written the code in CA1H and it is available for download for free. They even have a sample calling program, written in COBOL, that is used to verify the installation. There's not much more than copying, compiling, and adding some CICS table entries to get that solution up and running.


Because the provided samples utilize CICS Sockets. Sockets is only setup in about 10% of our CICS regions. Our shop is massive and I did not want to setup CICS Sockets in every region. I wanted a solution that required a few CSD entries and an interface program that could be transaction invoked and started off the sequential terminal.

This is something that a external hosting costumer requested and I wanted a quick and easy solution.

Instead I just created a step in the CICS region's job to simply read a cardlib and using an IEBGENER, I wrote the SYSUT2 to the SMTP sysout class.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10203
Location: italy

PostPosted: Tue Apr 05, 2011 11:06 am    Post subject: Reply to: SMTP email through TDQ
Reply with quote

Quote:
Because the provided samples utilize CICS Sockets

only partially true!

Quote:
The sample programs show methods of interfacing a CICS application with SMTP. The programs are intended to demonstrate various methods of sending email from within a CICS application. This is accomplished by utilizing either the CICS SPOOL interface or the CICS TCP/IP sockets interface. The SPOOL interface requires the use of the MVS SMTP server. The sockets interface can utilize any SMTP server accessible on the TCP/IP network.


looks like the TS forgot to read completely the docs !
Back to top
View user's profile Send private message
valyk

Active User


Joined: 16 Apr 2008
Posts: 104
Location: South Carolina

PostPosted: Tue Apr 05, 2011 5:54 pm    Post subject:
Reply with quote

I'll admit that I did not read the doc thoroughly. I opened the Zip file containing the source code and I saw the calls to EZASOKET and I knew that it was not a route that I wanted to take.

Also, I wanted to see if the TDQ method would work...
Back to top
View user's profile Send private message
valyk

Active User


Joined: 16 Apr 2008
Posts: 104
Location: South Carolina

PostPosted: Tue Apr 05, 2011 11:16 pm    Post subject:
Reply with quote

It looks like I am going to have to eat my words. The batch step did not operate as expected.

So I used the Spool write method.

When I originally said, 'but that is very convoluted and would be irritating for someone in the future to come across.', I thought you were implying that I write a job to the internal reader.
Back to top
View user's profile Send private message
Earl Haigh

Active User


Joined: 25 Jul 2006
Posts: 475

PostPosted: Fri Apr 08, 2011 5:17 am    Post subject:
Reply with quote

Unemployed and too broke to retire.

That makes two of us..

I'm already practicing for the Job I'll need AFTER
the Java boys push me aside.

"do you want fries with that?"

icon_biggrin.gif

Earl
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 -> CICS All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Reading data from PS file and send it... rajatbagga All Other Mainframe Topics 18 Fri Sep 23, 2016 12:51 pm
No new posts How to send email with Rich Text usin... santhosh5983 JCL & VSAM 4 Fri Apr 08, 2016 2:30 am
No new posts Email trigger through JCL Madhusudhan Prahlad JCL & VSAM 10 Mon Aug 31, 2015 3:43 pm
No new posts Empty excel attachment in mail receiv... gs185008 COBOL Programming 8 Mon Jul 13, 2015 7:45 pm
No new posts Dot "." missing from email ... Harsh Pawar JCL & VSAM 3 Thu Apr 30, 2015 4:13 pm


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