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

SMTP Problem while sending a mail with attachment


IBM Mainframe Forums -> All Other Mainframe Topics
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
prakash89.gitam

New User


Joined: 30 Aug 2012
Posts: 6
Location: india

PostPosted: Wed Sep 12, 2012 4:04 pm
Reply with quote

Hi....

I am writing a jcl to send a mail with attachment(attachment name should have opc date) through smtp job.

Firstly to get OPC date in attachment name i kept file name in jcl as shown below...

Code:

//EMAIL   EXEC PGM=IEBGENER,COND=(0,LT)             
//SYSUT1   DD  DSN=smtp.header,DISP=SHR   
//         DD *                                     
          FILENAME="UNEVEN_REPRT_&ODMY1..CSV"       
                                                   
//         DD  DSN=attachment.data,DISP=SHR   
//SYSUT2   DD  SYSOUT=(B,SMTP),DEST=GBNUHON1       
//SYSIN    DD  DUMMY                               
//SYSPRINT DD  SYSOUT=*                   


If i keep this inside header , job is working fine, but attachment name has no opc date.
Code:

          FILENAME="UNEVEN_REPRT_&ODMY1..CSV"       


So inorder to get opc date i kept this as shown above.

My header is like this
Code:

HELO MAINFRAME.abc.com
MAIL FROM: <from__address@abc.com>                 
RCPT TO: <to_address@def.com>                   
DATA                                                   
FROM:     abc
TO:      <to_address@def.com>                   
SUBJECT:  some subject
MIME-VERSION:1.0                                       
CONTENT-TYPE:MULTIPART/MIXED;BOUNDARY="SIMPLE BOUNDARY"
--SIMPLE BOUNDARY                                       
mail msg
--SIMPLE BOUNDARY               
CONTENT-TYPE: TEXT/PLAIN       
CONTENT-DISPOSITION: ATTACHMENT;



Now the problem is some data is getting appended to the File name. You can see that in below , i got this in spool
Code:

CONTENT-TYPE: TEXT/PLAIN                         
CONTENT-DISPOSITION: ATTACHMENT;                 
          FILENAME="UNEVEN_REPRT_&ODMY1..CSV"     
                        @abc.com>             


From above i understood that some data is getting appended to the filename , so it is not working.... Can anyone tell me why it is getting appended...
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Wed Sep 12, 2012 6:45 pm
Reply with quote

Quote:
Firstly to get OPC date in attachment name i kept file name in jcl

No, you did not. It is part of your SYSIN data. JCL begins with a // (unless it is /* - end of inline input statement. I do not recall, from reading other posts over the years if OPC will fiddle with data. I am not going to re-read as you should have done it before posting.
Back to top
View user's profile Send private message
David Robinson

Active User


Joined: 21 Dec 2011
Posts: 199
Location: UK

PostPosted: Wed Sep 12, 2012 6:55 pm
Reply with quote

There's a few things I'm not quite clear about here.

Is the &OYMD1 variable getting resolved or not? I think you've said it is, but in the output from your spool it appears not?

If it is, then I assume that's unrelated to the issue you're getting which I think is an erroneous @abc.com> ??
Back to top
View user's profile Send private message
michael baker

New User


Joined: 11 Oct 2011
Posts: 26
Location: United States of America

PostPosted: Wed Sep 12, 2012 8:03 pm
Reply with quote

Apologies for my confusion here. I removed a link which was not "to a Competitor Site" which was in fact to a private individual's site with no advertising.

Michael has provided me with this in place of the link, which I will try to locate.

Bill Woodger


Quote:
//SENDNOTE EXEC PGM=IEBGENER
//SYSIN DD DUMMY
//SYSPRINT DD SYSOUT=*
//SYSUT2 DD SYSOUT=(B,SMTP)
//SYSUT1 DD *
helo MVSHOST
mail from:<MVSUser@MVSHost.xyz.com>
rcpt to:<unixuser@pop3.xyz.com>
data
From: MVSUser@MVSHost.xyz.com
To: unixuser@pop3.xyz.com
Subject: Test message from MVS using SMTP

This is a line in the body of the example note.

You will need to change:
"MVSHOST" (on the "helo MVSHOST" line) must match the JES Node name for your system as defined in your 'SYS1.PARMLIB(IEFSSNxx)' for the VMCF subsystem. If you are a JES2 site, look at any JES2 job log for the node name at the top after "N O D E".
"unixuser@pop3.xyz.com" to valid destination SMTP e-mail address
"MVSuser@MVSHost.xyz.com" to a valid TSO user and host

Note: Although you can spoof e-mail by putting anything here, your installation has the ability to go back and track when you do this. Do not use this ability to spoof e-mail and think you can't get caught! SMF records are written and with a little research, the mail spoofer will be found out.

I intentionally leave the Date: SMTP command off. When IBM's SMTP task processes your note, it will add the date and time information if not found. I've seen that if the date SMTP command was not of the right format that MS-Exchange reports the wrong time.


And Michael's comment:

Quote:
I was unable to find any SMTP attatchment problems similar to what the poster is describing.... Since "abc.com is located on the "helo MVSHOST" line... my thoughts are validating that area first..... I might be wrong, but at least its a start.


The link is, I think, here.
Back to top
View user's profile Send private message
prakash89.gitam

New User


Joined: 30 Aug 2012
Posts: 6
Location: india

PostPosted: Thu Sep 13, 2012 12:22 pm
Reply with quote

Nic Clouston wrote:
Quote:
Firstly to get OPC date in attachment name i kept file name in jcl

No, you did not. It is part of your SYSIN data. JCL begins with a // (unless it is /* - end of inline input statement. I do not recall, from reading other posts over the years if OPC will fiddle with data. I am not going to re-read as you should have done it before posting.


Nic Clouston , By keeping file name outside i am able to get my OPC date.... so that is not a problem anymore. My problem is the data that is getting appended.


Quote:
Is the &OYMD1 variable getting resolved or not? I think you've said it is, but in the output from your spool it appears not?

If it is, then I assume that's unrelated to the issue you're getting which I think is an erroneous @abc.com> ??


OPC variable is not the problem, my problem is with @abc.ocm> i am unable to know cause of the problem..
Back to top
View user's profile Send private message
michael baker

New User


Joined: 11 Oct 2011
Posts: 26
Location: United States of America

PostPosted: Sat Sep 15, 2012 10:02 pm
Reply with quote

(I was unable to find any SMTP attatchment problems similar to what the poster is describing.... Since "abc.com is located on the "helo MVSHOST" line... my thoughts are validating that area first..... I might be wrong, but at least its a start.)




//SENDNOTE EXEC PGM=IEBGENER
//SYSIN DD DUMMY
//SYSPRINT DD SYSOUT=*
//SYSUT2 DD SYSOUT=(B,SMTP)
//SYSUT1 DD *
helo MVSHOST
mail from:<MVSUser@MVSHost.xyz.com>
rcpt to:<unixuser@pop3.xyz.com>
data
From: MVSUser@MVSHost.xyz.com
To: unixuser@pop3.xyz.com
Subject: Test message from MVS using SMTP

This is a line in the body of the example note.

You will need to change:
"MVSHOST" (on the "helo MVSHOST" line) must match the JES Node name for your system as defined in your 'SYS1.PARMLIB(IEFSSNxx)' for the VMCF subsystem. If you are a JES2 site, look at any JES2 job log for the node name at the top after "N O D E".
"unixuser@pop3.xyz.com" to valid destination SMTP e-mail address
"MVSuser@MVSHost.xyz.com" to a valid TSO user and host

Note: Although you can spoof e-mail by putting anything here, your installation has the ability to go back and track when you do this. Do not use this ability to spoof e-mail and think you can't get caught! SMF records are written and with a little research, the mail spoofer will be found out.

I intentionally leave the Date: SMTP command off. When IBM's SMTP task processes your note, it will add the date and time information if not found. I've seen that if the date SMTP command was not of the right format that MS-Exchange reports the wrong time.

The above info is derived from the below wesite:
(THIS LINK IS/WAS FOUND ON THIS WEB SITE FROM A 2004 POST BY MODERATOR SUPERK)
www.planetmvs.com/mvsmail/
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


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

PostPosted: Sat Sep 15, 2012 11:35 pm
Reply with quote

Some previous threads:

www.ibmmainframes.com/viewtopic.php?t=42894&highlight=attachment+attachement
www.ibmmainframes.com/viewtopic.php?t=42894&highlight=attachment+attachement
www.ibmmainframes.com/viewtopic.php?t=44546&highlight=attachment+attachement
www.ibmmainframes.com/viewtopic.php?t=47701&highlight=attachment+attachement
www.ibmmainframes.com/viewtopic.php?t=50244&highlight=attachment+attachement
www.ibmmainframes.com/viewtopic.php?t=31751&highlight=attachment+attachement

Apart from the above, this JCL will send the attachment:
Code:
//MAILPROC EXEC PGM=IEBGENER
//SYSPRINT DD   SYSOUT=*
//SYSUT2   DD   SYSOUT=(B,SMTP)
//SYSIN    DD   DUMMY
//*
//SYSUT1 DD *
HELO MVSHOST
MAIL FROM: <me@me.com>
RCPT TO: <someone@some.com>
DATA
FROM:     me@me.com
TO:       Anuj
SUBJECT:  TEST ATTACHMENT
MIME-VERSION: 1.0
CONTENT-TYPE: TEXT/PLAIN
CONTENT-DISPOSITION: ATTACHMENT; FILENAME=FILE.TXT
//       DD DSN=anuj.email.attachment(attached),DISP=SHR
//       DD DSN=anuj.email.attachment(singledot),DISP=OLD


The data in anuj.email.attachment(attached) becomes the attachment. Possibly, you can workaround this to get going.
Back to top
View user's profile Send private message
prakash89.gitam

New User


Joined: 30 Aug 2012
Posts: 6
Location: india

PostPosted: Mon Sep 17, 2012 3:41 pm
Reply with quote

Hi Anuj,

I tried it as you said, but i got RC 12, my jcl is shown below.

Code:

//MAILPROC EXEC PGM=IEBGENER                                   
//SYSPRINT DD   SYSOUT=*                                       
//SYSUT2   DD   SYSOUT=(B,SMTP),DEST=XXXXXXXX                 
//SYSIN    DD   DUMMY                                         
//SYSUT1 DD *                                                 
HELO MXS HOST
MAIL FROM: <from@mail.com>                       
RCPT TO: <to@mail.com>                         
DATA                                                           
FROM:     From
TO:       <to@mail.com>                         
SUBJECT:  TEST ATTACHMENT                                     
MIME-VERSION: 1.0                                             
CONTENT-TYPE:MULTIPART/MIXED;BOUNDARY="SIMPLE BOUNDARY"       
--SIMPLE BOUNDARY   
mail message                                         
--SIMPLE BOUNDARY                               
CONTENT-TYPE: TEXT/PLAIN                         
CONTENT-DISPOSITION: ATTACHMENT;                 
          FILENAME="Report_Name_&ODMY1..CSV"   
                                                 
//       DD DSN=dataset.name,DISP=SHR   



In spool it is like this
Code:

IEB311I CONFLICTING DCB PARAMETERS
IEB311I CONFLICTING DCB PARAMETERS


My dataset is of LRECL 56. I tried in both ways by giving "." in second dd, and without giving it. But result is same.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Sep 17, 2012 3:50 pm
Reply with quote

Please note the updates to Michael Baker's post above.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Sep 17, 2012 3:57 pm
Reply with quote

//SYSUT1 DD *

any DD * will always be a record length of 80.

have no idea what you meant with the '.' being a problem.

but,
suggest that you change the record length of this dataset
DD DSN=dataset.name,DISP=SHR
to 80 from 56.

that is what the conflicting dcb parameters message is about.
Back to top
View user's profile Send private message
prakash89.gitam

New User


Joined: 30 Aug 2012
Posts: 6
Location: india

PostPosted: Mon Sep 17, 2012 4:34 pm
Reply with quote

dbzTHEdinosauer wrote:
//SYSUT1 DD *

any DD * will always be a record length of 80.

have no idea what you meant with the '.' being a problem.

but,
suggest that you change the record length of this dataset
DD DSN=dataset.name,DISP=SHR
to 80 from 56.

that is what the conflicting dcb parameters message is about.


Thanks for the reply. BUT.
I need the name of the attachement(file) to conatin the OPC date(like filename_170912.txt). And if this syntax of attachement is kept in the dataset then OPC variable(date) is not updated and so the file name is shown as filename_&ODMY1..txt

Hence I have kept the filename outside the dataset and directly into the SYSUT1.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Sep 17, 2012 4:43 pm
Reply with quote

The only BUT i see is the one where your head is stuck.

I said, change the record length of your file to 80 (from 56)
and it should work.
at least it will get beyond the conflicting dcb parms.
Back to top
View user's profile Send private message
prakash89.gitam

New User


Joined: 30 Aug 2012
Posts: 6
Location: india

PostPosted: Mon Sep 17, 2012 4:50 pm
Reply with quote

dbzTHEdinosauer wrote:
The only BUT i see is the one where your head is stuck.

I said, change the record length of your file to 80 (from 56)
and it should work.
at least it will get beyond the conflicting dcb parms.


I am sorry I cant change that, the dataset should be of 56 record length.

any other alternative?
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: Mon Sep 17, 2012 4:57 pm
Reply with quote

Create a data set with 56 record length, put this in it:
Code:
HELO MXS HOST
MAIL FROM: <from@mail.com>                       
RCPT TO: <to@mail.com>                         
DATA                                                           
FROM:     From
TO:       <to@mail.com>                         
SUBJECT:  TEST ATTACHMENT                                     
MIME-VERSION: 1.0                                             
CONTENT-TYPE:MULTIPART/MIXED;BOUNDARY="SIMPLE BOUNDARY"       
--SIMPLE BOUNDARY   
mail message                                         
--SIMPLE BOUNDARY                               
CONTENT-TYPE: TEXT/PLAIN                         
CONTENT-DISPOSITION: ATTACHMENT;                 
          FILENAME="Report_Name_&ODMY1..CSV"   
 
and change your JCL to concatenate this data set and your other data set together.

If this doesn't appeal to you, then get used to the idea that what you want to do -- under the restrictions you keep placing on it -- cannot be done.
Back to top
View user's profile Send private message
prakash89.gitam

New User


Joined: 30 Aug 2012
Posts: 6
Location: india

PostPosted: Mon Sep 17, 2012 5:09 pm
Reply with quote

Robert Sample wrote:
Create a data set with 56 record length, put this in it:
Code:
HELO MXS HOST
MAIL FROM: <from@mail.com>                       
RCPT TO: <to@mail.com>                         
DATA                                                           
FROM:     From
TO:       <to@mail.com>                         
SUBJECT:  TEST ATTACHMENT                                     
MIME-VERSION: 1.0                                             
CONTENT-TYPE:MULTIPART/MIXED;BOUNDARY="SIMPLE BOUNDARY"       
--SIMPLE BOUNDARY   
mail message                                         
--SIMPLE BOUNDARY                               
CONTENT-TYPE: TEXT/PLAIN                         
CONTENT-DISPOSITION: ATTACHMENT;                 
          FILENAME="Report_Name_&ODMY1..CSV"   
 
and change your JCL to concatenate this data set and your other data set together.

If this doesn't appeal to you, then get used to the idea that what you want to do -- under the restrictions you keep placing on it -- cannot be done.


Hi Robert,

That dataset is being you used by some other jcls, so i said that i cant change it.

I tried by keeping this in dataset of record length 56 , but i didnt get the OPC date in the file name.

I can summarize the problem as
1) If i keep the syntax in a dataset of record length 56, OPC date is not getting updated.
2) If i dont keep it in dataset it is saying "CONFLICTING DCB PARAMETERS"


Need help in solving it....
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: Mon Sep 17, 2012 5:17 pm
Reply with quote

I think you are going to have to admit that what you want to do cannot be done, since you keep putting restrictions and raising reasons that things can't be done, rather than making the changes to make things work.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Sep 17, 2012 5:17 pm
Reply with quote

Why don't you have a step to copy your 56-byte dataset to an 80-byte dataset? Easy for your Sort product or any number of other methods.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Mon Sep 17, 2012 5:49 pm
Reply with quote

Create a copy of your 56 byte file but with an LRECL of 80. Now everything is 80. If the person at the other end want 56 then they will have to convert back. If they do not want to do that then send the file on a floppy or pen drive through the mail. You cannot mix and match 56 - or any other value not 80 - and 80 byte data in SYSIN to IEBGENER or most other programs.

Edit: page 2 strikes again so I am duplicating what Robert posted.
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 -> All Other Mainframe Topics

 


Similar Topics
Topic Forum Replies
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts mail attachment with excel format All Other Mainframe Topics 2
No new posts z/vm installation problem All Other Mainframe Topics 0
No new posts Job scheduling problem. JCL & VSAM 9
No new posts Problem with IFTHEN=(WHEN=GROUP,BEGIN... DFSORT/ICETOOL 5
Search our Forums:

Back to Top