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

How to email the file ZIped in mainframe through JCL


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

New User


Joined: 19 Mar 2010
Posts: 5
Location: Bangalore

PostPosted: Fri Mar 19, 2010 11:41 pm
Reply with quote

I have to send an email from JCL with an attachment. The attachment has nearly 40,000 records with record length 60.



When the mail is received, the records in the attachment will be truncated and will get maximum of 2500 records only.
So any one suggest what should be changed in the below process so that all the records can be send in the attachment?



The JCL step is as below.



Code:
//*****************************************************************
//* EMAIL THE EXTRACT FROM FIRST STEP TO THE CUSTOMER             
//*****************************************************************
//STEP1   EXEC PGM=LINKABND,PARM=(UCANDU,12)                     
//SYSPRINT DD  SYSOUT=*                                           
//SYSUT1   DD  DSN=STEP1.EMAIL.CONTROL.LIB(EMAILST),         
//             DISP=SHR                                           
//         DD  DSN=STEP1.INPUT.FILE1,DISP=SHR   
//SYSUT2   DD  SYSOUT=(B,SMTP)                                     
//SYSIN    DD  *                                                   
  COPY,ALL                                                         
//*                                                               



Where STEP1.INPUT.FILE1 is the file to be attached and STEP1.EMAIL.CONTROL.LIB(EMAILST)contains



Code:
HELO TORGPC                                                         
MAIL FROM:<first.last@ABC.COM>                                   
RCPT TO:< first.last@ABC.COM >                                     
DATA                                                                 
FROM:     first.last@ABC.COM
TO:       first.last@ABC.COM
SUBJECT:  TEST MAIL
CONTENT-TYPE: TEXT/PLAIN                                             
CONTENT-DISPOSITION: ATTACHMENT; FILENAME=TESTFILE.TXT   



Hence we zipped the input file using the below jcl steps and used the same email as above to email. We received the email and attachment as zipped file. But had problem in opening it and got the error something like “Downloaded zip file not archived properly”



Code:
//********************************************************************
//QD30025  EXEC PGM=PKZIP,REGION=6M                                   
//SYSPRINT DD SYSOUT=*                                               
//ZIPCUR   DD DSN=STEP1.INPUT.FILE1,DISP=SHR   
//OUTARCH  DD DSN=STEP1.INPUT.FILE1.ZIP,                       
//            DISP=(,CATLG,DELETE),                                   
//            UNIT=SCRTCH,SPACE=(TRK,(500,50),RLSE),                 
//            DCB=(LRECL=1000,RECFM=F,BLKSIZE=22800)                             
//SYSIN    DD *                                                       
-ECHO                                                               
-ADD -NOPATH                                                         
-ARCHOUTDD(OUTARCH)                                                   
-INDD(ZIPCUR)                                                         
//                                                                   
//* 






Hence the ZIP file was then converted to BASE 64 using the below jcl step and emailed using the next step.



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--


code' d and reformatted for readability
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: Fri Mar 19, 2010 11:55 pm
Reply with quote

Contact your site support group, explain the problem to them, and get their help in resolving it. When the TCP/IP stack is installed for z/OS, there is a default size limit on SMTP emails. If you have exceeded this limit, nothing you can do in your job will allow you to get around that limit -- only your site support group can change the limit, issue an OBEYFILE against TCP/IP, and allow your complete email to be sent. If the issue is something else, your site support group is again the place to start as they have the tools to diagnose the problem and help you resolve it.
Back to top
View user's profile Send private message
Manju_savi

New User


Joined: 19 Mar 2010
Posts: 5
Location: Bangalore

PostPosted: Sat Mar 20, 2010 10:55 pm
Reply with quote

Thank you for guiding. But In order avoid that we ZIPed the file uisng PKZIP as below and then sent an email. But had problem in opening it and got the error something like “Downloaded zip file not archived properly”

//********************************************************************

//QD30025 EXEC PGM=PKZIP,REGION=6M

//SYSPRINT DD SYSOUT=*

//ZIPCUR DD DSN=STEP1.INPUT.FILE1,DISP=SHR

//OUTARCH DD DSN=STEP1.INPUT.FILE1.ZIP,

// DISP=(,CATLG,DELETE),

// UNIT=SCRTCH,SPACE=(TRK,(500,50),RLSE),

// DCB=(LRECL=1000,RECFM=F,BLKSIZE=22800)

//SYSIN DD *

-ECHO

-ADD -NOPATH

-ARCHOUTDD(OUTARCH)

-INDD(ZIPCUR)

//

//*


Hence the ZIP file was then converted to BASE 64 using the below jcl step and emailed using the next step. But not able to send the ZIP file properly through email.



//*-----------------------------------------------------

//*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



HELO TORGPC

MAIL FROM:<MANJUNATHA.M@CGI.COM>

RCPT TO:<MANJUNATHA.M@CGI.COM>

DATA

FROM: SMB RA - ONTARIO - JVH019

TO: MANJUNATHA.M@CGI.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



------ =_NEXTPART_000_01BD3BAF.A762FD80--
Back to top
View user's profile Send private message
Manju_savi

New User


Joined: 19 Mar 2010
Posts: 5
Location: Bangalore

PostPosted: Sat Mar 20, 2010 10:58 pm
Reply with quote

So can you please send me the proper steps to email the file Ziped in mainframe through JCL?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sat Mar 20, 2010 10:58 pm
Reply with quote

Hello,

Pull the file manually from the mainframe to your pc and see if it will open.

If it will not open, the problem is not the email/jcl, but rather the file itself.
Back to top
View user's profile Send private message
Manju_savi

New User


Joined: 19 Mar 2010
Posts: 5
Location: Bangalore

PostPosted: Sat Mar 20, 2010 11:15 pm
Reply with quote

Yes, I pulled the Ziped file from mainframe to PC and tried opening but it gave below error message.

"End-of-central-directory signature not found. Either this file is not a Zip file, or it constitutes one disk of a multi-part Zip file"

Means in the mainframe file is not Ziped properly. Or it might ziped in EBSIDC format and in PC it is ASCI format. This could be the probelm. If yes how this can be solved.
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: Sun Mar 21, 2010 12:31 am
Reply with quote

The problem will not be that the data file is EBCDIC and the PC is ASCII -- zip file control bytes are in binary, not EBCDIC or ASCII.

Your problem indicates a PKZIP issue. Contact the vendor and get their help -- only the vendor can tell you why this problem is occurring and how to fix it.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sun Mar 21, 2010 1:52 am
Reply with quote

Hello,

When you manually downloaded the file, hopefully BINARY was specified for the transfer . . .
Back to top
View user's profile Send private message
Manju_savi

New User


Joined: 19 Mar 2010
Posts: 5
Location: Bangalore

PostPosted: Sun Mar 21, 2010 8:56 am
Reply with quote

Thank you for the reply, I will contact the vendor and will update here accordingly
Back to top
View user's profile Send private message
ajithajt

New User


Joined: 21 Mar 2016
Posts: 10

PostPosted: Wed Apr 06, 2016 11:57 pm
Reply with quote

Hi,

I also used the same code to send a zip file as attachment in mail. When performing FTP from mainframe I am able to open the ZIP file, but when I try to open the file which I received through mail its showing the error message “This is not a valid ZIP archive”. Also the zip file should have a size of 6mb, but the file which I received through mail has only 260 B. Please help me to resolve this.


Thanks,
Ajith.
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Thu Apr 07, 2016 1:03 am
Reply with quote

Did you read Robert's post on Mar 20, 2010 at 2:01 pm?
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 1:47 am
Reply with quote

An attachment of 260 bytes indicates to me that your MIME is not working. You need to review your JCL, paying particular attention to the MIME definitions since a single byte mistake can cause the email attachment to fail. Since you didn't post any JCL there's not much we can do to help you.

And when you have an issue, start a new topic -- don't append to the end of a 6-year-old thread.
Back to top
View user's profile Send private message
ajithajt

New User


Joined: 21 Mar 2016
Posts: 10

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

Hello,
I am sorry for that. Since I am a new user I was not aware of that. I opened a new thread. Here is the link.
ibmmainframes.com/viewtopic.php?p=334678#334678

Please help me to resolve this issue.

Thanks in advance.
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 How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Mainframe openings in Techmahnidra fo... Mainframe Jobs 0
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top