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

Issue in sending zip file as mail attachment using jcl


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ajithajt

New User


Joined: 21 Mar 2016
Posts: 10

PostPosted: Thu Apr 07, 2016 9:11 am
Reply with quote

Hi,

I want to send a zip file as attachment in mail using jcl. I was able to zip the file and I tried a ftp also, it is working for me. But when I tried to do the same via email its not working. So I converted the zip file to Base64 and tried to send using the below code. I am receiving a mail with the zip attachment, but I am not able to open it since it is a corrupted file. My original zip file should have a size of 6mb, but the file I am receiving is only 260 B. I have also attached the screen shot of SYSUT2. Please advice me on how to resolve this.

Code:
 //*-----------------------------------------------------
 //*ENCODE THE ZIP FILE USING THE ENBASE64 REXX EXEC
 //*-----------------------------------------------------
 //JVSREX01 EXEC PGM=IKJEFT01,PARM='ENBASE64'
 //SYSEXEC DD DSN=TSJV.A9ZMM.SMBCR.JCLLIB,DISP=SHR
 //SYSOUT DD SYSOUT=*
 //SYSPRINT DD SYSOUT=*
 //SYSTSPRT DD SYSOUT=*
 //SYSIN DD DUMMY
 //SYSTSIN DD DUMMY
 //SYSUT1 DD DSN=STEP1.INPUT.FILE1.ZIP,DISP=SHR
 //SYSUT2 DD DSN=STEP1.INPUT.FILE1.BASE,
 // DISP=(,PASS),UNIT=SYSDA,
 // DCB=(LRECL=133,BLKSIZE=27930,RECFM=FB),
 // SPACE=(CYL,(5,0),RLSE)
 //***********************************************************
 //*SEND THE EMAIL
 //***********************************************************
 //JVSREX02 EXEC PGM=IEBGENER
 //SYSPRINT DD SYSOUT=*
 //SYSUT1 DD DSN=STEP2.EMAIL.CONTROL.LIB(emaillst1),
 // DISP=SHR
 // DD DSN= STEP1.INPUT.FILE1.BASE,DISP=(OLD,PASS)
 // DD DSN= STEP2.EMAIL.CONTROL.LIB(emaillst2),DISP=SHR
 //SYSUT2 DD SYSOUT=(B,SMTP)
 //SYSIN DD DUMMY
 //


Where STEP2.EMAIL.CONTROL.LIB(emaillst1) contains

Code:
 HELO TORGPC
 MAIL FROM:<XYZ@rediff.COM>
 RCPT TO:<XYZ@rediff.COM>
 DATA
 FROM: SMB RA - ONTARIO - JVH019
 TO: XYZ@rediff.COM
 SUBJECT: SMB RA - ONTARIO - ADHOC ORDER ACTIVITY EXTRACT
 MIME-VERSION: 1.0
 CONTENT-TYPE: MULTIPART/MIXED; BOUNDARY="---- =_NEXTPART_000_01BD3BAF.A7
 THIS MESSAGE IS IN MIME FORMAT. SINCE YOUR MAIL READER DOES NOT UNDERSTA
 THIS FORMAT, SOME OR ALL OF THIS MESSAGE MAY NOT BE LEGIBLE.
 ------ =_NEXTPART_000_01BD3BAF.A762FD80
 CONTENT-TYPE: TEXT/PLAIN; CHARSET="US-ASCII"
 CONTENT-TRANSFER-ENCODING: 7BIT
 ATTACHED IS A ZIP FILE
 ------ =_NEXTPART_000_01BD3BAF.A762FD80
 CONTENT-TYPE:APPLICATION/OCTET-STREAM; NAME=WAGNERC.ZIP
 CONTENT-TRANSFER-ENCODING: BASE64

CONTENT-DISPOSITION: ATTACHMENT; FILENAME=WAGNERC.ZIP

And STEP2.EMAIL.CONTROL.LIB(emaillst2) contains

Code:
 ------ =_NEXTPART_000_01BD3BAF.A762FD80--


In SYSUT2

[img][/img]
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Apr 07, 2016 9:42 am
Reply with quote

Have you sent a text file as an attachment and gotten it as an attachment to your email? If not, you need to do that first to get the syntax and spacing correct before mixing in other, more complicated file formats like ZIP or Base64. If you have gotten text file as email attachments, look at the differences between the working text attachment JCL and what you posted.

Also, is the body of the email coming across?
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


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

PostPosted: Thu Apr 07, 2016 3:13 pm
Reply with quote

Please use the code tags when presenting JCL, code, control data, data, screen shots (do not use attachments - a simple cut'n'paste is sufficient) or anything else that requires fic]xed pitch fonts and spacing.

Being new to a forum does not mean that you do not have to read the rules - just the opposite.
Back to top
View user's profile Send private message
ajithajt

New User


Joined: 21 Mar 2016
Posts: 10

PostPosted: Thu Apr 21, 2016 9:01 am
Reply with quote

Hi All,

Using the above listed code now I am able to send the zip file as attachment. But still am facing one more issue. Actually I am having 5 text files. In that first four are of small size. All together will have less than 1mb of size. I am able to zip and send all the first four files as attachment. The attachment which I am receiving has 51 kb. But the last file is of 27 mb and when I try to zip and send I am not receiving any mails. Zip is working fine. 27 mb data is zipped to 6mb. But I am not receiving any mails while trying to send this large file.

Please advise me on this.

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

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Apr 21, 2016 9:23 am
Reply with quote

This is when you MUST talk to your site support group. SMTP as delivered in the TCP/IP configuration of z/OS has a limit of 512K for any messages, which includes attachments. This parameter can be customized by the site, but the value applies to the site not just to your emails. Your site support group can tell you what the allowed value is, and can get authorization to increase the value should your organization be able to provide adequate justification.
Back to top
View user's profile Send private message
ajithajt

New User


Joined: 21 Mar 2016
Posts: 10

PostPosted: Thu Apr 21, 2016 8:20 pm
Reply with quote

Hi Robert,

Thank you for the information. Is there any other alternative way for sending this big text file as zip attachment.

Thanks.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


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

PostPosted: Thu Apr 21, 2016 8:53 pm
Reply with quote

Also give a try for PKZIP and if you could have searched more yourself then you could also see these topics topic#1 and topic#2
If PKZIP too doesn't work then follow Robert's instruction to contact site support.
Or I advise to if YOU CAN SFTP to a common location/server/drive and in the email body give the instructions for the above the location.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Apr 21, 2016 8:54 pm
Reply with quote

Who knows? I don't work at your site so I have no idea what software is installed there. There might be something to handle emails. If not, you could use FTP but that would NOT be an email attachment.

I said it earlier, and I'll repeat it: Contact your site support group!

Rohit: poster says zip is already being used so how does PKZIP help?
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


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

PostPosted: Thu Apr 21, 2016 9:21 pm
Reply with quote

Thanks Robert, I take that back. icon_smile.gif
Quote:
PKZIP ensures that compressed data is secure during transmission and storage. File sizes can be reduced by up to 95% and protected with persistent security with PKZIP.
so also suggested.
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top