View previous topic :: View next topic
|
Author |
Message |
sakrat
Active User
Joined: 05 Feb 2014 Posts: 164 Location: India
|
|
|
|
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 |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1205 Location: Dublin, Ireland
|
|
|
|
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 |
|
|
sakrat
Active User
Joined: 05 Feb 2014 Posts: 164 Location: India
|
|
|
|
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 |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1205 Location: Dublin, Ireland
|
|
|
|
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 |
|
|
sakrat
Active User
Joined: 05 Feb 2014 Posts: 164 Location: India
|
|
|
|
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 |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1205 Location: Dublin, Ireland
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
sakrat
Active User
Joined: 05 Feb 2014 Posts: 164 Location: India
|
|
|
|
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 |
|
|
sakrat
Active User
Joined: 05 Feb 2014 Posts: 164 Location: India
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
sakrat
Active User
Joined: 05 Feb 2014 Posts: 164 Location: India
|
|
|
|
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 |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1205 Location: Dublin, Ireland
|
|
|
|
Where are the required
?
My previous post was of a working e-mail with attachment.
Garry. |
|
Back to top |
|
|
sakrat
Active User
Joined: 05 Feb 2014 Posts: 164 Location: India
|
|
|
|
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 |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1205 Location: Dublin, Ireland
|
|
|
|
Can you show content of the z/OS dataset? Does it look like a .csv file?
The
lines have to be concatenated after the z/OS dataset JCL statement.
Garry. |
|
Back to top |
|
|
sakrat
Active User
Joined: 05 Feb 2014 Posts: 164 Location: India
|
|
|
|
Garry Carroll wrote: |
Can you show content of the z/OS dataset? Does it look like a .csv file?
The
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 |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1205 Location: Dublin, Ireland
|
|
|
|
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 |
|
|
sakrat
Active User
Joined: 05 Feb 2014 Posts: 164 Location: India
|
|
|
|
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 |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1205 Location: Dublin, Ireland
|
|
|
|
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 |
|
|
sakrat
Active User
Joined: 05 Feb 2014 Posts: 164 Location: India
|
|
|
|
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 |
|
|
sakrat
Active User
Joined: 05 Feb 2014 Posts: 164 Location: India
|
|
|
|
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....
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 |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1205 Location: Dublin, Ireland
|
|
|
|
The three datasets need to have the same DCB info. Try creating the MIME control cards in a dataset with LRECL=141 and put the . & QUIT into another LRECL=141 dataset.
// DD * datasets will have LRECL=80 which is conflicting with the .csv dataset DCB.
Garry. |
|
Back to top |
|
|
sakrat
Active User
Joined: 05 Feb 2014 Posts: 164 Location: India
|
|
|
|
Garry Carroll wrote: |
The three datasets need to have the same DCB info. Try creating the MIME control cards in a dataset with LRECL=141 and put the . & QUIT into another LRECL=141 dataset.
// DD * datasets will have LRECL=80 which is conflicting with the .csv dataset DCB.
Garry. |
The code which i have posted above has three datasets with same LRECL 141....
All the three has RECFM = FB, LRECL=141 and BLKSIZE=27918 |
|
Back to top |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1205 Location: Dublin, Ireland
|
|
|
|
Have you read
www-01.ibm.com/support/docview.wss?uid=swg21512178 ?
and have you got the "boundary" identifier in all required places. In this example, you'll see it before the text
Code: |
Content-Type: text/plain;
|
and before and after the data to be in the attachment
Code: |
Content-Type: application;
Content-Disposition: attachment; filename=cert.cer;
Content-Transfer-Encoding: 8bit; |
Garry. |
|
Back to top |
|
|
sakrat
Active User
Joined: 05 Feb 2014 Posts: 164 Location: India
|
|
|
|
Garry Carroll wrote: |
Have you read
www-01.ibm.com/support/docview.wss?uid=swg21512178 ?
and have you got the "boundary" identifier in all required places. In this example, you'll see it before the text
Code: |
Content-Type: text/plain;
|
and before and after the data to be in the attachment
Code: |
Content-Type: application;
Content-Disposition: attachment; filename=cert.cer;
Content-Transfer-Encoding: 8bit; |
Garry. |
I modified the code giving boundary as specified in the link above:
Code: |
HELO ***
MAIL FROM: <***.***@***.COM>
RCPT TO: <***.***@***.COM>
DATA
FROM: <*** TEAM>
TO: < DEV TEAM>
SUBJECT: CONTROL-M DOCUMENTATION
MIME-VERSION: 1.0
CONTENT-TYPE: MULTIPART/MIXED;
BOUNDARY="---- =_BOUNDS"
THIS MESSAGE IS IN MIME FORMAT.
---- =_BOUNDS
CONTENT-TYPE: TEXT/PLAIN;
PLEASE FIND THE ATTACHED CONTROL-M DOCUMENT.
NOTICE:
THIS EMAIL IS CONFIDENTIAL
---- =_BOUNDS
CONTENT-TYPE: TEXT/PLAIN;
CONTENT-DISPOSITION: ATTACHMENT;
FILENAME="CNTRL-M DOCUMENT.CSV"
---- =_BOUNDS
|
JCL :
Code: |
//SENDMAIL EXEC PGM=IEBGENER,
// COND=(0,NE)
//SYSIN DD DUMMY
//SYSPRINT DD SYSOUT=*
//SYSUT2 DD SYSOUT=(B,SMTP)
//SYSUT1 DD DSN=***.TEST.CNTRL.EMAIL,DISP=SHR
// DD DSN=***.****.FINAL.CNTRLM.DOC,DISP=SHR
// DD DSN=***.QUIT.STMT,DISP=SHR
|
and I receive a mail with no attachments but in the BODY OF THE MAIL I receive everything like below :
Code: |
BOUNDARY="---- =_BOUNDS"
THIS MESSAGE IS IN MIME FORMAT.
---- =_BOUNDS
CONTENT-TYPE: TEXT/PLAIN;
PLEASE FIND THE ATTACHED CONTROL-M DOCUMENT.
NOTICE:
THIS EMAIL IS CONFIDENTIAL
---- =_BOUNDS
CONTENT-TYPE: TEXT/PLAIN;
CONTENT-DISPOSITION: ATTACHMENT;
FILENAME="CNTRL-M DOCUMENT.CSV"
---- =_BOUNDS
NEW,PREJOBS,Q075SBEJ,Q075CB ,CONCATENATE B12960 AND SBF, D6W1
00000100
QUIT |
De-bolded |
|
Back to top |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1205 Location: Dublin, Ireland
|
|
|
|
Move the last
to AFTER the
Code: |
// DD DSN=***.****.FINAL.CNTRLM.DOC,DISP=SHR |
.
You last =_BOUNDS is delimiting the
Code: |
---- =_BOUNDS
CONTENT-TYPE: TEXT/PLAIN; |
Garry |
|
Back to top |
|
|
|