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
 

 

Empty CSV file attachment while sending mail
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
sakrat

Active User


Joined: 05 Feb 2014
Posts: 159
Location: India

PostPosted: Mon Apr 27, 2015 6:51 pm    Post subject: Empty CSV file attachment while sending mail
Reply with quote

Hi Please find the code below, I get an empty CSV file attachment mail. can some one please correct the code if any thing is wrong.

Code:


//SENDMAIL EXEC PGM=IEBGENER,
//             COND=(0,NE)
//SYSPRINT  DD   SYSOUT=*
//SYSIN     DD   DUMMY
//SYSOUT    DD   SYSOUT=*
//SYSUT1    DD   DSN=***.****.CNTRL.EMAIL,
//                DISP=SHR
//          DD  DSN=***.******.FINAL.CNTRLM.DOC,
//         DISP=SHR
//SYSUT2    DD  SYSOUT=(B,SMTP)



***.****.CNTRL.EMAIL Contains below :

Code:


HELO ***
MAIL FROM: <***.***@*****.COM>
RCPT TO: <****.******@****.COM>
DATA
FROM: <*** TEAM>
SUBJECT: CONTROL-M DOCUMENTATION
MIME-VERSION: 1.0
CONTENT-TYPE: MULTIPART/MIXED; BOUNDARY="SIMPLE-BOUNDARY"

--SIMPLE-BOUNDARY
CONTENT-TYPE: TEXT/PLAIN

PLEASE FIND THE ATTACHED CONTROL-M DOCUMENT.

 --SIMPLE-BOUNDARY
 CONTENT-TYPE: MULTIPART/MIXED;
 CONTENT-DISPOSITION: ATTACHMENT; FILENAME="CONTRL-M_DOCUMENT.CSV"



***.******.FINAL.CNTRLM.DOC has the data that has to come in the CSV formmated excel.


Thanks,
Back to top
View user's profile Send private message

Garry Carroll

Active Member


Joined: 08 May 2006
Posts: 988
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Mon Apr 27, 2015 7:14 pm    Post subject:
Reply with quote

You don't seem to have a TO:<.....> field?

but also, check the order and presence of the lines. My version works for me...
Code:
MIME-VERSION: 1.0                                                 
CONTENT-TYPE: MULTIPART/MIXED; BOUNDARY="SIMPLE BOUNDARY"         
                                                                 
--SIMPLE BOUNDARY                                                 
CONTENT-TYPE: TEXT/PLAIN                                         
CONTENT-DISPOSITION: INLINE                                       
                                                                 
Attached, please find the required .csv file for your attention. 
                                                                 
NOTICE:                                                           
This e-mail (including any attachment) is confidential and       
is intended solely for the addressee. Please delete this         
and any attachments if you are not the intended recipient.       
                                                                 
--SIMPLE BOUNDARY                                                 
CONTENT-TYPE: TEXT/PLAIN                                         
CONTENT-DISPOSITION: ATTACHMENT; FILENAME=GARRY.CSV
                                                                 
//         DD DISP=SHR,DSN=GARRY.CSV               
.
QUIT
                                                           


you seem to be missing the CONTENT-DISPOSITION: INLINE

Garry.
Back to top
View user's profile Send private message
sakrat

Active User


Joined: 05 Feb 2014
Posts: 159
Location: India

PostPosted: Mon Apr 27, 2015 7:40 pm    Post subject:
Reply with quote

Garry Carroll wrote:
You don't seem to have a TO:<.....> field?


// DD DISP=SHR,DSN=GARRY.CSV
.
QUIT
[/code]

you seem to be missing the CONTENT-DISPOSITION: INLINE

Garry.


Garry, Why is that we need to mention the DD and DSN here because i have already included in the data to be attached in the file name : ***.******.FINAL.CNTRLM.DOC in the code above.....?
Back to top
View user's profile Send private message
Garry Carroll

Active Member


Joined: 08 May 2006
Posts: 988
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Mon Apr 27, 2015 7:48 pm    Post subject:
Reply with quote

My understanding is that the file name you give in the control cards dataset DSN=***.******.FINAL.CNTRLM.DOC ( i.e. FILENAME="CONTRL-M_DOCUMENT.CSV" ) is the name to be given to the e-mail attachment by the SMTP server. The SMTP server has to access the actual z/OS dataset from JCL in order to include it.

You could have z/OS dataset ABC.CSV attached as XYZ.CSV, for example.

Garry.
Back to top
View user's profile Send private message
sakrat

Active User


Joined: 05 Feb 2014
Posts: 159
Location: India

PostPosted: Mon Apr 27, 2015 7:53 pm    Post subject:
Reply with quote

Garry Carroll wrote:
My understanding is that the file name you give in the control cards dataset DSN=***.******.FINAL.CNTRLM.DOC ( i.e. FILENAME="CONTRL-M_DOCUMENT.CSV" ) is the name to be given to the e-mail attachment by the SMTP server. The SMTP server has to access the actual z/OS dataset from JCL in order to include it.

You could have z/OS dataset ABC.CSV attached as XYZ.CSV, for example.

Garry.


You mean that the file name and the DSN name should be same.....?
Back to top
View user's profile Send private message
Garry Carroll

Active Member


Joined: 08 May 2006
Posts: 988
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Mon Apr 27, 2015 7:58 pm    Post subject:
Reply with quote

No. What I mean is that the JCL must contain the file (DSN=??) you've prepared on z/OS but the attachment name, given in the FILENAME='.....' control card can be entirely different and is the name the e-mail recipient will see.

Garry.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Mon Apr 27, 2015 10:48 pm    Post subject:
Reply with quote

I have found SMTP on z/OS to be EXTREMELY sensitive to the format and location of the control statements. If what you have isn't working, you will most likely need to experiment -- CONTENT-DISPOSITION and CONTENT-TYPE need to match the data file data, for example.
Back to top
View user's profile Send private message
sakrat

Active User


Joined: 05 Feb 2014
Posts: 159
Location: India

PostPosted: Mon Apr 27, 2015 11:32 pm    Post subject:
Reply with quote

Robert Sample wrote:
I have found SMTP on z/OS to be EXTREMELY sensitive to the format and location of the control statements. If what you have isn't working, you will most likely need to experiment -- CONTENT-DISPOSITION and CONTENT-TYPE need to match the data file data, for example.



What do you mean by content-disposition and content-type need to match the data file data...I changed the code and now the RC is zero but I sm not getting any mail....
Back to top
View user's profile Send private message
sakrat

Active User


Joined: 05 Feb 2014
Posts: 159
Location: India

PostPosted: Mon Apr 27, 2015 11:36 pm    Post subject:
Reply with quote

Garry Carroll wrote:
No. What I mean is that the JCL must contain the file (DSN=??) you've prepared on z/OS but the attachment name, given in the FILENAME='.....' control card can be entirely different and is the name the e-mail recipient will see.

Garry.

I tried the code the way you have written but now I am not getting any mail and the return code is zero. ..
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Tue Apr 28, 2015 12:27 am    Post subject:
Reply with quote

A CSV file will NOT be "multipart/mixed" -- that phrase should occur one time at the beginning of the email definition. CSV files are PLAIN/TEXT.

As I said, you really have to experiment depending upon what you are attempting to do -- and you may have to run a dozen or more tests to get the results you want.
Back to top
View user's profile Send private message
sakrat

Active User


Joined: 05 Feb 2014
Posts: 159
Location: India

PostPosted: Tue Apr 28, 2015 12:33 pm    Post subject:
Reply with quote

Hi,

Changed the code as mentioned,and still I am getting empty email attachment when using SMTP
Please see the JCL used below:


Code:


//SENDMAIL EXEC PGM=IEBGENER,
//             COND=(0,NE)
//SYSPRINT DD   SYSOUT=*
//SYSUT1   DD   DSN=***.****.CNTRL.EMAIL,DISP=SHR
//         DD   DSN=***.****.FINAL.CNTRLM.DOC,DISP=SHR
//SYSUT2   DD   SYSOUT=(B,SMTP)



***.****.CNTRL.EMAIL has contents below :

Code:

 
HELO ***
MAIL FROM: <***.***@***.COM>
RCPT TO: <***.***@***.COM>
DATA
FROM: <*** TEAM>
TO: < *** TEAM>
SUBJECT: CONTROL-M DOCUMENTATION
MIME-VERSION: V1.0
CONTENT-TYPE: MULTIPART/MIXED; BOUNDARY="SIMPLE BOUNDARY"

--SIMPLE BOUNDARY
CONTENT-TYPE: TEXT/PLAIN
CONTENT-DISPOSITION: INLINE

PLEASE FIND THE ATTACHED CONTROL-M DOCUMENT.

NOTICE:
THIS EMAIL IS CONFIDENTIAL

--SIMPLE BOUNDARY
CONTENT-TYPE:TEXT/PLAIN;
CONTENT-DISPOSITION: ATTACHMENT; FILENAME=CNTRL-M DOC.CSV



Kindly help me in solving this issue, I tried all the ways as far as i know but nothing is working and i still get an empty CSV file as attachment.


Thanks,
Back to top
View user's profile Send private message
Garry Carroll

Active Member


Joined: 08 May 2006
Posts: 988
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Tue Apr 28, 2015 12:56 pm    Post subject:
Reply with quote

Where are the required
Code:
.
QUIT
?

My previous post was of a working e-mail with attachment.

Garry.
Back to top
View user's profile Send private message
sakrat

Active User


Joined: 05 Feb 2014
Posts: 159
Location: India

PostPosted: Tue Apr 28, 2015 12:59 pm    Post subject:
Reply with quote

Still the same issue even after adding QUIT

Code:


HELO ***
MAIL FROM: <***.***@***.COM>
RCPT TO: <***.***@***.COM>
DATA
FROM: <*** TEAM>
TO: < *** TEAM>
SUBJECT: CONTROL-M DOCUMENTATION
MIME-VERSION: V1.0
CONTENT-TYPE: MULTIPART/MIXED; BOUNDARY="SIMPLE BOUNDARY"

--SIMPLE BOUNDARY
CONTENT-TYPE: TEXT/PLAIN
CONTENT-DISPOSITION: INLINE

PLEASE FIND THE ATTACHED CONTROL-M DOCUMENT.

NOTICE:
THIS EMAIL IS CONFIDENTIAL

--SIMPLE BOUNDARY
CONTENT-TYPE:TEXT/PLAIN;
CONTENT-DISPOSITION: ATTACHMENT; FILENAME=CNTRL-M DOC.CSV
.
QUIT



I get the attachment but is empty excel....
Back to top
View user's profile Send private message
Garry Carroll

Active Member


Joined: 08 May 2006
Posts: 988
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Tue Apr 28, 2015 1:05 pm    Post subject:
Reply with quote

Can you show content of the z/OS dataset? Does it look like a .csv file?

The
Code:
.
QUIT 
lines have to be concatenated after the z/OS dataset JCL statement.

Garry.
Back to top
View user's profile Send private message
sakrat

Active User


Joined: 05 Feb 2014
Posts: 159
Location: India

PostPosted: Tue Apr 28, 2015 1:14 pm    Post subject:
Reply with quote

Garry Carroll wrote:
Can you show content of the z/OS dataset? Does it look like a .csv file?

The
Code:
.
QUIT 
lines have to be concatenated after the z/OS dataset JCL statement.

Garry.


content of the dataset that has to be sent as attachment

Code:


***.***.FINAL.CNTRLM.DOC

NEW,***JOBS,JOBNAME,TABNAME,JOB DESCRIPTION,WORKING DAYS



earlier i had dataset in two lines the first line same as above and the second being the subset of the first doesnt have comma, so i tried removing the second line and ran even then it dint work out....

Old dataset format of records :

NEW,***JOBS,JOBNAME,TABNAME,JOB DESCRIPTION,WORKING DAYS
JOB1 CONT OF DESC
JOB2
JOB3

where JOB1, JOB2 and JOB3 being present under JOBNAME and continuation of the JOB Description will be in second line....

Also I tried giving the . and QUIT after concatenating the dataset containing records, but i am getting error for that....
Back to top
View user's profile Send private message
Garry Carroll

Active Member


Joined: 08 May 2006
Posts: 988
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Tue Apr 28, 2015 1:20 pm    Post subject:
Reply with quote

Well, the z/OS dataset looks OK.

Quote:
Also I tried giving the . and QUIT after concatenating the dataset containing records, but i am getting error for that....


Can you show how you concatenated the . & QUIT and what the result was?

Garry.
Back to top
View user's profile Send private message
sakrat

Active User


Joined: 05 Feb 2014
Posts: 159
Location: India

PostPosted: Tue Apr 28, 2015 1:31 pm    Post subject:
Reply with quote

Garry Carroll wrote:
Well, the z/OS dataset looks OK.

Quote:
Also I tried giving the . and QUIT after concatenating the dataset containing records, but i am getting error for that....


Can you show how you concatenated the . & QUIT and what the result was?

Garry.


Here is the code below :

Code:


//SENDMAIL EXEC PGM=IEBGENER,
//             COND=(0,NE)
//SYSPRINT DD   SYSOUT=*
//SYSUT2   DD   SYSOUT=(B,SMTP)
//SYSUT1   DD   *
HELO ***
MAIL FROM: <***.***@***.COM>
RCPT TO: <***.***@***.COM>
DATA
FROM: <*** TEAM>
TO: < DEV TEAM>
SUBJECT: CONTROL-M DOCUMENTATION
MIME-VERSION: V1.0
CONTENT-TYPE: MULTIPART/MIXED; BOUNDARY="SIMPLE BOUNDARY"

--SIMPLE BOUNDARY
CONTENT-TYPE: TEXT/PLAIN
CONTENT-DISPOSITION: INLINE

PLEASE FIND THE ATTACHED CONTROL-M DOCUMENT.

NOTICE:
THIS EMAIL IS CONFIDENTIAL


--SIMPLE BOUNDARY
CONTENT-TYPE:TEXT/PLAIN;
CONTENT-DISPOSITION: ATTACHMENT; FILENAME=CONTROL-M DOCUMENT.CSV
//         DD   DSN=***.****.FINAL.CNTRLM.DOC,DISP=SHR
.
QUIT




and the error is :



DATA SET UTILITY - GENERATE
.
IEB344I WARNING- INVALID STATEMENT LABEL
IEB339I COMMAND MISSING PRECEDING COL.71
QUIT
IEB339I COMMAND MISSING PRECEDING COL.71



the return code is 12 and the above error is obtained from SYSPRINT.
Back to top
View user's profile Send private message
Garry Carroll

Active Member


Joined: 08 May 2006
Posts: 988
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Tue Apr 28, 2015 1:36 pm    Post subject:
Reply with quote

You should have :

Code:
//         DD   DSN=***.****.FINAL.CNTRLM.DOC,DISP=SHR
//         DD * 
.
QUIT


The . and QUIT are not JCL statements, therefore the error messages.

Garry
Back to top
View user's profile Send private message
sakrat

Active User


Joined: 05 Feb 2014
Posts: 159
Location: India

PostPosted: Tue Apr 28, 2015 2:28 pm    Post subject:
Reply with quote

Garry Carroll wrote:
You should have :

Code:
//         DD   DSN=***.****.FINAL.CNTRLM.DOC,DISP=SHR
//         DD * 
.
QUIT


The . and QUIT are not JCL statements, therefore the error messages.

Garry



I changed and ran the code now i get conflicting DCB parameters like


IEB352I WARNING: ONE OR MORE OF THE OUTPUT DCB PARMS COPIED FROM INPUT
IEB311I CONFLICTING DCB PARAMETERS
IEB311I CONFLICTING DCB PARAMETERS


the record length of the dataset ***.***.FINAL.CNTRLM.DOC is 141 and then the MIME version everything i give inside DD *, how is that it is showing conflicting DCB parameters....?
Back to top
View user's profile Send private message
sakrat

Active User


Joined: 05 Feb 2014
Posts: 159
Location: India

PostPosted: Tue Apr 28, 2015 2:30 pm    Post subject:
Reply with quote

Swathi Muralidharan wrote:
Garry Carroll wrote:
You should have :

Code:
//         DD   DSN=***.****.FINAL.CNTRLM.DOC,DISP=SHR
//         DD * 
.
QUIT


The . and QUIT are not JCL statements, therefore the error messages.

Garry



I changed and ran the code now i get conflicting DCB parameters like


IEB352I WARNING: ONE OR MORE OF THE OUTPUT DCB PARMS COPIED FROM INPUT
IEB311I CONFLICTING DCB PARAMETERS
IEB311I CONFLICTING DCB PARAMETERS


the record length of the dataset ***.***.FINAL.CNTRLM.DOC is 141 and then the MIME version everything i give inside DD *, how is that it is showing conflicting DCB parameters....?


I moved all to a file names and then ran the code...But no content in attachment mail even now.... icon_sad.gif


Code:


//SENDMAIL EXEC PGM=IEBGENER,
//             COND=(0,NE)
//SYSIN    DD   DUMMY
//SYSPRINT DD   SYSOUT=*
//SYSUT2   DD   SYSOUT=(B,SMTP)
//SYSUT1   DD   DSN=***.****.CNTRL.EMAIL,DISP=SHR
//         DD   DSN=***.****.FINAL.CNTRLM.DOC,DISP=SHR
//         DD   DSN=***.QUIT.STMT,DISP=SHR




[/code]
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 -> JCL & VSAM All times are GMT + 6 Hours
Goto page 1, 2, 3  Next
Page 1 of 3

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm


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