Page 1 of 1

JCL SMTP Problem

PostPosted: Tue Mar 20, 2012 6:37 pm
by Aditya Jain
Hi,
I am trying to send an email to my official id via JCL
For the sake of the below example lets consider the following
my RACF ID : Z99999
Node name : TTTTTTT
( I obtained the Node name from JES2 job log it was written as "N O D E T T T T T T T". I presumed that the node name would be excluding spaces as "TTTTTTT" )
my official email id : ABC@XYZ.com
Following is the JCL step I am trying to run
//SENDNOTE EXEC PGM=IEBGENER
//SYSIN DD DUMMY
//SYSPRINT DD SYSOUT=*
//SYSUT2 DD SYSOUT=(B,SMTP)
//SYSUT1 DD *
helo TTTTTTT
mail from: <ABC@XYZ.com>
rcpt to: <ABC@XYZ.com>
data
From: <ABC@XYZ.com>
To: <ABC@XYZ.com>
Subject: Test message from MVS using SMTP
This is a line in the body of the note. :)
Aditya Jain
/*

The above code returns a MAXCC zero but the email is not received. Please help.
I've tried putting my RACF ID instead of < ABC@XYZ.com> too.. still it doesn't work.. Please help

Re: JCL SMTP Problem

PostPosted: Tue Mar 20, 2012 7:45 pm
by MrSpock
Looks OK to me. Did you check with your site's internal support to make sure SMTP is enabled?

Re: JCL SMTP Problem

PostPosted: Tue Mar 20, 2012 11:50 pm
by dick scherrer
Hello,

There should be some informational/diagnostic message(s) presented when the job is run.

If you post these, it may help ssomeone help you.

Re: JCL SMTP Problem

PostPosted: Wed Mar 21, 2012 2:36 am
by Robert Sample
SMTP requires an ending record consisting of nothing but a period. Without this record, the data is discarded by SMTP. The job will run, it will return a normal zero code, but the email will never be received -- does that sound familiar? Try this:
//SENDNOTE EXEC PGM=IEBGENER
//SYSIN DD DUMMY
//SYSPRINT DD SYSOUT=*
//SYSUT2 DD SYSOUT=(B,SMTP)
//SYSUT1 DD *
helo TTTTTTT
mail from: <ABC@XYZ.com>
rcpt to: <ABC@XYZ.com>
data
From: <ABC@XYZ.com>
To: <ABC@XYZ.com>
Subject: Test message from MVS using SMTP
This is a line in the body of the note. :)
Aditya Jain
.
/*

Re: JCL SMTP Problem

PostPosted: Wed Mar 21, 2012 7:46 pm
by Aditya Jain
Thanks guys.. Somehow, the code that Robert Sample posted didn't work.. I found some other working code.. it had an OUTPUT statement with a DEST parameter and the SYSUT2 was associated with that OUTPUT statement

like

OUT1 OUTPUT DEST=XXXXX,
USERDATA = ('TO:ABC@XYZ.com',
'SUBJECT:TEST')
SYSUT2 DD SYSOUT=(I),OUTPUT=(*.out1)

I searched for the above statements on the internet.. found some info too but couldn't understand a word.. Please explain the above statements

Re: JCL SMTP Problem

PostPosted: Wed Mar 21, 2012 8:24 pm
by Robert Sample
That is not SMTP and your post title clearly indicates SMTP -- which I provided a modification to the JCL you posted that fixed your problem with SMTP. I think you need to stop posting until you know just what it is youre attempting to accomplish and what tool(s) you wish to use.

The OUTPUT statement is part of JES and explained in the JCL Language Reference manual, and it is obvious that you need to contact someone working AT YOUR SITE to find out the various parameters being used at your site. For example, the JCL Language Reference manual states for the USERDATA option of the OUTPUT statement:
22.70 USERDATA Parameter


Parameter Type

Keyword, optional

Purpose

The purpose and use of this keyword is defined by the installation. Refer to your installation's definition on the intent and use of this keyword.
Where the quote refers to "installation" -- read YOUR SITE.

Re: JCL SMTP Problem

PostPosted: Sat Mar 24, 2012 11:14 am
by Aditya Jain
Yes, its my fault.. I didn't mention what exactly I was trying to achieve.. I was trying to send an email via JCL.. that should've been my post title.. Also the line, "Somehow, the code that Robert Sample posted didn't work" should've been "Unfortunately, the code that Robert Sample posted didn't work which I guess is due to my site's installation.".. Also, the ending period for SMTP, this info is missing across various websites..

Thank you Robert for your invaluable contribution.. :)

Thanks MrSpock

Thanks dick scherrer

Re: JCL SMTP Problem

PostPosted: Sat Mar 24, 2012 6:27 pm
by Robert Sample
Google rfc smtp and find RFC 2821, which is the official specification for SMTP. If you read it, and I have, you'll find -- on page 17/18 -- these words:
Since the mail data is sent on the transmission channel, the end of
mail data must be indicated so that the command and reply dialog can
be resumed. SMTP indicates the end of the mail data by sending a
line containing only a "." (period or full stop). A transparency
procedure is used to prevent this from interfering with the user's
text (see section 4.5.2).

The end of mail data indicator also confirms the mail transaction and
tells the SMTP server to now process the stored recipients and mail
data. If accepted, the SMTP server returns a 250 OK reply.
So whatever web sites you were looking at are not official; it's not surprising they are misleading or wrong because they don't tell you about the line with the period. And there are a number of other RFC specifications that can be handy to know about.