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
 

 

How to email the file ZIped in mainframe through JCL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: How to email the file ZIped in mainframe through JCL
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: 7913
Location: Bellevue, IA

PostPosted: Fri Mar 19, 2010 11:55 pm    Post subject:
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    Post subject: Reply to: How to email the file ZIped in mainframe through J
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    Post subject: Reply to: How to email the file ZIped in mainframe through J
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

Site Director


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

PostPosted: Sat Mar 20, 2010 10:58 pm    Post subject:
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    Post subject: Reply to: How to email the file ZIped in mainframe through J
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: 7913
Location: Bellevue, IA

PostPosted: Sun Mar 21, 2010 12:31 am    Post subject:
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

Site Director


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

PostPosted: Sun Mar 21, 2010 1:52 am    Post subject:
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    Post subject:
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: 6
Location: Kerala

PostPosted: Wed Apr 06, 2016 11:57 pm    Post subject: Same issue
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: 1238
Location: Richfield, MN, USA

PostPosted: Thu Apr 07, 2016 1:03 am    Post subject:
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: 7913
Location: Bellevue, IA

PostPosted: Thu Apr 07, 2016 1:47 am    Post subject: Reply to: How to email the file ZIped in mainframe through JCL
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: 6
Location: Kerala

PostPosted: Thu Apr 07, 2016 9:16 am    Post subject: Reply to: How to email the file ZIped in mainframe through JCL
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.
http://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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

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
This topic is locked: you cannot edit posts or make replies. Urgent Mainframe Requirments (2-10 yr... Shankar779 Mainframe Jobs 0 Sun Nov 27, 2016 1:48 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


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