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

[Solved]Email attachment from mainframe is empty


IBM Mainframe Forums -> PC Guides & IT News
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Marc12205

New User


Joined: 05 Jun 2024
Posts: 5
Location: USA

PostPosted: Wed Jun 05, 2024 7:44 pm
Reply with quote

I have searched the forum and tried more options and code than I could explain.
I was finally successful in getting an attachment but it is empty.
here is my JCL:
//EMAIL9 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSIN DD DUMMY
//SYSUT2 DD SYSOUT=(B,SMTP),DCB=(RECFM=FB,LRECL=110,BLKSIZE=110)
//SYSUT1 DD DISP=SHR,DSN=DB2011.DAXXJ09D.EMAIL.HEADER
// DD DISP=SHR,DSN=DB2011.DAXXJ09D.DYWK.GRAPHS
// DD DISP=SHR,DSN=DB2011.DAXXJ09D.DYWK.REPORT
// DD DISP=SHR,DSN=DB2011.DAXXJ09D.EMAIL.ATTATCH
// DD DISP=SHR,DSN=DB2011.DAXXJ09D.DYWK.REPCSV
// DD DISP=SHR,DSN=DB2011.DAXXJ09D.EMAIL.FOOTER

all datasets match lrecl & blksz so the email is successful

here are the contents of HEADER - masks are ##
HELO ##
MAIL FROM:<MF_MAIL@##>
RCPT TO:<FNTSDBSUPPORT@##>
DATA
TO: "## yesterday Db2 Stats"
FROM: SMTP@##
SUBJECT: Db2 Yesterday's I/O, CPU & SQL Stats
MIME-VERSION: 1.0
CONTENT-TYPE: MULTIPART/MIXED; BOUNDARY="@NextSection"
--@NextSection
CONTENT-TYPE: text/plain;

Then the next two come out fine on the email.

ATTACH:
--@NextSection
CONTENT-TYPE: text/csv; NAME=DB2yesterday.csv;
CONTENT-DISPOSITION: ATTACHMENT; FILENAME=DB2yesterday.csv;

REPCSV does have data in it and another 13 lines below this snippet:
BEGDATE,AVG_IOSEC,CPU_SQL,ELAP_SQL,SQLCNT,ELAPHR,CPUHR,IOCNT,IOSEC,PFETCH
2024-03-12,0.000254943, 0.000034, 0.000078, 635322985, 13.730507, 6.047882, 70105869, 17873,18707580

FOOTER:
--@NextSection
.
QUIT

The email gets to me and has two attachments - both empty and I have exhausted all I know, so I hope someone can spot my mistake.
TIA
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2140
Location: USA

PostPosted: Wed Jun 05, 2024 8:14 pm
Reply with quote

1. Use the Code button

Marc12205 wrote:
I have searched the forum and tried more options and code than I could explain.
I was finally successful in getting an attachment but it is empty.
here is my JCL:
Code:
//EMAIL9  EXEC PGM=IEBGENER                                         
//SYSPRINT  DD SYSOUT=*                                             
//SYSIN     DD DUMMY                                               
//SYSUT2    DD SYSOUT=(B,SMTP),DCB=(RECFM=FB,LRECL=110,BLKSIZE=110)
//SYSUT1    DD DISP=SHR,DSN=DB2011.DAXXJ09D.EMAIL.HEADER           
//          DD DISP=SHR,DSN=DB2011.DAXXJ09D.DYWK.GRAPHS             
//          DD DISP=SHR,DSN=DB2011.DAXXJ09D.DYWK.REPORT             
//          DD DISP=SHR,DSN=DB2011.DAXXJ09D.EMAIL.ATTATCH           
//          DD DISP=SHR,DSN=DB2011.DAXXJ09D.DYWK.REPCSV             
//          DD DISP=SHR,DSN=DB2011.DAXXJ09D.EMAIL.FOOTER


all datasets match lrecl & blksz so the email is successful

here are the contents of HEADER - masks are ##
Code:
HELO ##                                           
MAIL FROM:<MF_MAIL@##>                           
RCPT TO:<FNTSDBSUPPORT@##>                       
DATA                                                   
TO: "## yesterday Db2 Stats"                         
FROM: SMTP@##                               
SUBJECT: Db2 Yesterday's I/O, CPU & SQL Stats     
MIME-VERSION: 1.0                                     
CONTENT-TYPE: MULTIPART/MIXED; BOUNDARY="@NextSection"
--@NextSection                                         
CONTENT-TYPE: text/plain;


Then the next two come out fine on the email.

Code:
ATTACH:
--@NextSection                                               
CONTENT-TYPE: text/csv; NAME=DB2yesterday.csv;               
CONTENT-DISPOSITION: ATTACHMENT; FILENAME=DB2yesterday.csv;


REPCSV does have data in it and another 13 lines below this snippet:
Code:
BEGDATE,AVG_IOSEC,CPU_SQL,ELAP_SQL,SQLCNT,ELAPHR,CPUHR,IOCNT,IOSEC,PFETCH                               
2024-03-12,0.000254943,   0.000034,   0.000078, 635322985, 13.730507,  6.047882, 70105869, 17873,18707580

FOOTER:
--@NextSection
.             
QUIT 


The email gets to me and has two attachments - both empty and I have exhausted all I know, so I hope someone can spot my mistake.
TIA


2. Is there any log in your //SYSPRINT DD?

3. As the first step of verification, change your //SYSUT2 DD to SYSOUT=* and check carefully: how the concatenated data look like?
Back to top
View user's profile Send private message
Marc12205

New User


Joined: 05 Jun 2024
Posts: 5
Location: USA

PostPosted: Wed Jun 05, 2024 8:20 pm
Reply with quote

SYSPRINT:
Code:

1DATA SET UTILITY - GENERATE                                                                     
  WER813I  INSTALLATION OPTIONS IN MFX LOAD LIBRARY WILL BE USED                                 
  WER276B  SYSDIAG= 8070921, 13035276, 13035276, 36212725                                       
  WER164B  6,888K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,                             
  WER164B     44K BYTES RESERVE REQUESTED, 592K BYTES USED                                       
  WER146B  32K BYTES OF EMERGENCY SPACE ALLOCATED                                               
  WER108I  SYSUT1   : RECFM=FB   ; LRECL=   110; BLKSIZE=   110                                 
  WER073I  SYSUT1   : DSNAME=DB2011.DAXXJ09D.EMAIL.HEADER  (FIRST OF 6)                         
  WER110I  SYSUT2   : RECFM=FB   ; LRECL=   110; BLKSIZE=   110                                 
  WER074I  SYSUT2   : DSNAME=DB2SYS.DAXXJ09D.JOB29762.D000009A.?                                 
  WER410B  5,856K BYTES OF VIRTUAL STORAGE AVAILABLE ABOVE THE 16-MEGABYTE LINE,                 
  WER410B     0 BYTES RESERVE REQUESTED, 372K BYTES USED                                         
  WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000                                                 
  WER416B  SYSUT1   : EXCP'S=6,UNIT=3390,DEV=696E,CHP=(ECEEDE,1),VOL=P9TU01                     
  WER416B  BSAM WAS USED FOR SYSUT2                                                             
  WER054I  RCD IN        184, OUT        184                                                     
  WER169I  RELEASE 3.1 BATCH 0541 TPF LEVEL 5.0                                                 
  WER051I  DIAG=0109,FD00                                                                       
  WER052I  END SYNCSORT - DAXXJ09D,EMAIL9,,DIAG=A000,7380,88A2,00C4,E846,4403,8AE8,4666,0100,0300
 SYNCSORT COPY FEATURE CALLED - RC = 0                                                           
********************************************************** Bottom of Data ***********************
[quote]
I will try the SYSUT2 change, thanks.[/quote]
Back to top
View user's profile Send private message
Marc12205

New User


Joined: 05 Jun 2024
Posts: 5
Location: USA

PostPosted: Wed Jun 05, 2024 8:28 pm
Reply with quote

sergeyken,
changing SYSUT2 to SYSOUT=* shows the full concatenation but since it is not pushed to SMTP, no email was generated.

Did you want me to post the SYSUT2 output ?
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2140
Location: USA

PostPosted: Wed Jun 05, 2024 9:36 pm
Reply with quote

Marc12205 wrote:
sergeyken,
changing SYSUT2 to SYSOUT=* shows the full concatenation but since it is not pushed to SMTP, no email was generated.

Did you want me to post the SYSUT2 output ?

I suggested you to check carefully the full SMTP input to be submitted.

Every extra/missing comma matters.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3076
Location: NYC,USA

PostPosted: Wed Jun 05, 2024 9:59 pm
Reply with quote

Try having NAME AND FILENAME VALUES IN double quotes .
Second add - - SIMPLE BOUNDARY before CONTENT-TYPE
Back to top
View user's profile Send private message
Marc12205

New User


Joined: 05 Jun 2024
Posts: 5
Location: USA

PostPosted: Thu Jun 06, 2024 6:25 pm
Reply with quote

Thanks to all for your help.

The most simple thing was missing:
There should always be a blank line after the content headers:

www.ibm.com/support/pages/outbound-email-attachments-using-smtp-or-cssmtp-zos

It works now !
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3076
Location: NYC,USA

PostPosted: Thu Jun 06, 2024 6:48 pm
Reply with quote

Thanks for posting the resolution to help others.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2140
Location: USA

PostPosted: Thu Jun 06, 2024 9:40 pm
Reply with quote

Marc12205 wrote:
Thanks to all for your help.

The most simple thing was missing:
There should always be a blank line after the content headers:

www.ibm.com/support/pages/outbound-email-attachments-using-smtp-or-cssmtp-zos

It works now !


That's why I recommended you to take a closer look at your //SYSUT2 DD output, but you tried to shirk...
Back to top
View user's profile Send private message
Marc12205

New User


Joined: 05 Jun 2024
Posts: 5
Location: USA

PostPosted: Thu Jun 06, 2024 9:55 pm
Reply with quote

@sergeyken
I absolutely took your advice and used SYSUT2 output for further testing but everything looked perfect until I later found the article from IBM which said you need a blank line after the content headers.
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 -> PC Guides & IT News

 


Similar Topics
Topic Forum Replies
No new posts Reading Empty Dataset DFSORT/ICETOOL 5
No new posts Mainframe Dataset Binary or ASCII Mainframe Interview Questions 4
No new posts Need help In Mainframe Automation AF/... CLIST & REXX 14
No new posts SPOOL to Mainframe dataset in batch mode JCL & VSAM 7
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
Search our Forums:

Back to Top