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

ZIP file Sending through SMTP


IBM Mainframe Forums -> All Other Mainframe Topics
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
arjun.h

New User


Joined: 13 Jan 2012
Posts: 20
Location: India

PostPosted: Thu Jan 19, 2012 2:41 pm
Reply with quote

Hello guys,

I have read through a couple of pages on how to send an zip attachement through SMTP but none have the complete solution. sorry if you feel this is a repetition

Everything seems to be fine in Mainframe side and i didn't get any errors.
but when i tried opening the file in Windows using a ZIP utility it pops me the below error

[Cannot open the file: it doesn't appear to be a valid archive
if you downloaded this file , try downloading file again
]

I Zipped the file using PKZIP , the JCL is as below

Code:
[//STEP1  EXEC PGM=PKZIP,REGION=6M,TIME=90   
//STEPLIB  DD  DSN=SYSU.PKZIP.LOADLIB,DISP=SHR
//SYSUDUMP DD  SYSOUT=*                       
//SYSPRINT DD  SYSOUT=*                       
//SYSIN    DD  *                               
-ARCHIVE_DSN(XXXXXXXXXXXX)       
-ARCHUNIT(BIGPRD)                             
-ARCHSPACE(CYL)                               
-ARCHPRIMARY(10)                               
-ARCHSECONDARY(10)                             
-DATA_DELIMITER(LF)                           
-FILE_TERMINATOR(LF)                           
-TRANSLATE_TABLE_DATA(EBC#8859)               
-ACTION(ADD)                                   
YYYYYYYYYYYY                           
/*



Note:
XXXXXXXXXXXX --> OUTPUT DATASET
YYYYYYYYYYYY --> INPUT DATASET
]


Emailing step is as below

Code:
//STEP1  EXEC PGM=LINKABND,PARM=(UCANDU,12)                           
//SYSPRINT DD  SYSOUT=*                                                 
//SYSUT1   DD  DSN=EMAIL.LIST(CNTCRD),DISP=SHR                     
//         DD  DSN=XXXXXXXXXXXX,                     
//             DISP=SHR                                                 
//SYSUT2   DD DSN=TEMP.DATASET,                       
//            DISP=(,CATLG,DELETE),                                     
//            UNIT=SCRTCH,                                             
//            SPACE=(CYL,(10,10),RLSE),AVGREC=K,                       
//            DCB=(DCO01.DSCB,RECFM=U)
//SYSIN    DD  *                                                       
COPY,ALL                                                               
//*                                                                     
//STEP2  EXEC PGM=IEBGENER                                           
//SYSIN    DD DUMMY                                                     
//SYSPRINT DD  SYSOUT=*                                                 
//SYSUT1   DD  DSN=TEMP.DATASET,DISP=SHR                   
//SYSUT2   DD  SYSOUT=(A,SMTP)                                         
//*
]


Emailing details / Mime as below

[HELO xxxxx
MAIL FROM:<>
RCPT TO:<a@xxx.COM>
DATA
FROM: Report
TO: TEST MAIL
SUBJECT: Report
MIME-VERSION: 1.0
CONTENT-TYPE: APPLICATION/OCTET-STREAM; NAME="A.ZIP"
CONTENT-TRANSFER-ENCODING: BASE64 ]




Note: I tired using SAS to send the ZIped file and it was succesfull, i was able to open the Zip file in windows, which might mean by Zipping is fine.

Problem is I cant use SAS, Can anyone help me out of this. icon_sad.gif


inlined attached text
Code:


//STEP1  EXEC PGM=PKZIP,REGION=6M,TIME=90   
//STEPLIB  DD  DSN=SYSU.PKZIP.LOADLIB,DISP=SHR
//SYSUDUMP DD  SYSOUT=*                       
//SYSPRINT DD  SYSOUT=*                       
//SYSIN    DD  *                               
-ARCHIVE_DSN(XXXXXXXXXXXX)       
-ARCHUNIT(BIGPRD)                             
-ARCHSPACE(CYL)                               
-ARCHPRIMARY(10)                               
-ARCHSECONDARY(10)                             
-DATA_DELIMITER(LF)                           
-FILE_TERMINATOR(LF)                           
-TRANSLATE_TABLE_DATA(EBC#8859)               
-ACTION(ADD)                                   
YYYYYYYYYYYY                           
/*                                             


Note:
XXXXXXXXXXXX --> OUTPUT DATASET
YYYYYYYYYYYY --> INPUT DATASET



Emailing


//**********************************************************************
//STEP1  EXEC PGM=LINKABND,PARM=(UCANDU,12)                           
//SYSPRINT DD  SYSOUT=*                                                 
//SYSUT1   DD  DSN=EMAIL.LIST(CNTCRD),DISP=SHR                     
//         DD  DSN=XXXXXXXXXXXX,                     
//             DISP=SHR                                                 
//SYSUT2   DD DSN=TEMP.DATASET,                       
//            DISP=(,CATLG,DELETE),                                     
//            UNIT=SCRTCH,                                             
//            SPACE=(CYL,(10,10),RLSE),AVGREC=K,                       
//            DCB=(DCO01.DSCB,RECFM=FB,LRECL=385,BLKSIZE=0)             
//SYSIN    DD  *                                                       
COPY,ALL                                                               
//*                                                                     
//STEP2  EXEC PGM=IEBGENER                                           
//SYSIN    DD DUMMY                                                     
//SYSPRINT DD  SYSOUT=*                                                 
//SYSUT1   DD  DSN=TEMP.DATASET,DISP=SHR                   
//SYSUT2   DD  SYSOUT=(A,SMTP)                                         
//*                                                                     



Email list

HELO xxxxx                                         
MAIL FROM:<>                                         
RCPT TO:<a@xxx.COM>                   
DATA                                                 
FROM: Report                             
TO:  TEST MAIL                                       
SUBJECT: Report
MIME-VERSION: 1.0                                   
CONTENT-TYPE: APPLICATION/OCTET-STREAM; NAME="A.ZIP"
CONTENT-TRANSFER-ENCODING: BASE64                   


do not post attachments, not everybody can see them, reducing the number op people capable of helping
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 Jan 19, 2012 6:32 pm
Reply with quote

Have you tested with using a different encoding?
Have you tested with a multi-part MIME message?
Back to top
View user's profile Send private message
arjun.h

New User


Joined: 13 Jan 2012
Posts: 20
Location: India

PostPosted: Thu Jan 19, 2012 7:59 pm
Reply with quote

Robert,

I tired with the below and didn't even get a attachment in my mailbox

CONTENT-TYPE: MULTIPART/MIXED ; NAME="REPORT.ZIP"
CONTENT-TRANSFER-ENCODING: BASE64


Also i have tried

CONTENT-TYPE: PLAIN/TEXT ; NAME="REPORT.ZIP"
CONTENT-TRANSFER-ENCODING: BASE64

with no success.
Back to top
View user's profile Send private message
arjun.h

New User


Joined: 13 Jan 2012
Posts: 20
Location: India

PostPosted: Thu Jan 19, 2012 8:16 pm
Reply with quote

Robert,

Since we i am transferring to windows EBCDIC needs to be converted into ACSII and BASE64 does that. Advise me if am wrong on this.
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 Jan 19, 2012 8:34 pm
Reply with quote

Quote:
Since we i am transferring to windows EBCDIC needs to be converted into ACSII and BASE64 does that. Advise me if am wrong on this.
1. You are ABSOLUTELY WRONG on this. A ZIP file is a BINARY file and if you translate it to ASCII then you no longer have a ZIP file -- you have garbage. This would explain your results -- a ZIP file that was translated is not an archive anymore.

2. BASE64 is an ASCII-encoding and it is NOT used for binary (that is, ZIP) file transfers. You should be using a binary encoding for your SMTP transfer.
Back to top
View user's profile Send private message
arjun.h

New User


Joined: 13 Jan 2012
Posts: 20
Location: India

PostPosted: Fri Jan 20, 2012 10:32 am
Reply with quote

Hello Robert.


7bit and 8bit are binary encoding in MIME , i tried with then but same situation.

here are the three options that i have tried


CONTENT-TYPE: APPLICATION/OCTET-STREAM; NAME="REPORT.ZIP"
CONTENT-TRANSFER-ENCODING: 7BIT


CONTENT-TYPE: APPLICATION/OCTET-STREAM; NAME="REPORT.ZIP"
CONTENT-TRANSFER-ENCODING: 8BIT


MIME-VERSION: 1.0
CONTENT-TYPE: APPLICATION/OCTET-STREAM; NAME="REPORT.ZIP"
Back to top
View user's profile Send private message
arjun.h

New User


Joined: 13 Jan 2012
Posts: 20
Location: India

PostPosted: Fri Jan 20, 2012 3:25 pm
Reply with quote

More information

The Zipped file has the following properties

Organization . . . : PS
Record format . . . : U
Record length . . . : 0
Block size . . . . : 27998
Back to top
View user's profile Send private message
arjun.h

New User


Joined: 13 Jan 2012
Posts: 20
Location: India

PostPosted: Fri Jan 20, 2012 11:29 pm
Reply with quote

Hello All,

if anyone has a working job that does the zip with PKZIP and then send the file through SMTP , Please post.

icon_rolleyes.gif
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Sun Jan 22, 2012 1:39 am
Reply with quote

I have run into similar problem sometime back and was patiently waiting if someone would post a solution in this thread.

In our case we transferred the file to USS and zipped it there with TARZIP and then sent it through email. No exactly a solution, but a work around.
Back to top
View user's profile Send private message
superman

New User


Joined: 28 Mar 2011
Posts: 12
Location: india

PostPosted: Mon Jan 30, 2012 12:36 pm
Reply with quote

I think we need to change the length of the file, I think the error you get is because the length of all the SMTP files needs to be the same,else it gives an error.Did you try the same after modifying the length of the zipped file?
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Mon Jan 30, 2012 12:47 pm
Reply with quote

Superman,
How do you propose to modify the length of a zipped file and still have the contents intact? (With super human strength? :-) )
As far as i know, i think ZIP files are of RECFM=U and LRECL=0
Code:
Organization  . . . : PS 
Record format . . . : U   
Record length . . . : 0   
Block size  . . . . : 6144
Back to top
View user's profile Send private message
superman

New User


Joined: 28 Mar 2011
Posts: 12
Location: india

PostPosted: Mon Jan 30, 2012 2:45 pm
Reply with quote

Vasanth,

I had'nt thought of that.Does pose a problem.
So you mean to say there is no way I can transfer a PKZIP file via SMTP.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Jan 30, 2012 2:53 pm
Reply with quote

for an out of the box solution check
www.lbdsoftware.com/xmitip.html
and here for other useful hints
planetmvs.com/mvsmail/index.html
Back to top
View user's profile Send private message
arjun.h

New User


Joined: 13 Jan 2012
Posts: 20
Location: India

PostPosted: Tue Feb 07, 2012 6:24 pm
Reply with quote

Hello VasanthZ and Superman

I almost left this post as i really low on hope. hopefully this helps you

If zipping file to LRECL 80 will provide the solution here it is, you need to include two extra parameters
Code:

-ARCHUNIT(BIGPRD)   
-ARCHSPACE(CYL)     
-ARCHPRIMARY(10)     
-ARCHSECONDARY(10)   
-DATA_DELIMITER(LF) 
-FILE_TERMINATOR(LF)
-ARCHIVE_LRECL=080   
-ARCHIVE_RECFM=FB   
-TRANSLATE_TABLE_DATA(EBC#8859)     
-ACTION(ADD)

I was able to zip but failed with the SMTP
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Feb 07, 2012 6:32 pm
Reply with quote

deleted...
I had not noticed that sending a zipped file thru SAS worked!
Back to top
View user's profile Send private message
arjun.h

New User


Joined: 13 Jan 2012
Posts: 20
Location: India

PostPosted: Thu Feb 09, 2012 12:49 pm
Reply with quote

Enrico,

Yes SAS work fine. But whats with the JCL ?

I was able to send through SAS , its quite simple also.
Back to top
View user's profile Send private message
arjun.h

New User


Joined: 13 Jan 2012
Posts: 20
Location: India

PostPosted: Fri Feb 10, 2012 11:47 am
Reply with quote

Hello ALL,

Here is the piece of SAS code that works perfectly,I hope this turns out to be useful.


Code:
//SASMAIL EXEC SAS9,REGION=2M                                           
//SYSIN DD *                                                           
DATA;                                                                   
FILENAME MYFILE EMAIL                                                   
TO= "A@B.COM"                                         
FROM= "A@B.COM"                                       
SUBJECT= "SUBJECT OF UR MAIL"                                           
ATTACH= ('ZIP FILE PS NAME'
NAME = 'A' EXT="ZIP");  ----> ZIP FILE NAME IN MAIL                                               
DATA _NULL_;                                                           
FILE MYFILE;                                                           
PUT 'DESCRIPTION OF THE MAIL';                                         
RUN;                                                                   
QUIT;                                                                   
/*                                                                     



PS: There is Limit on SMTP, so if the sas execution went fine and you didnt receive the mail it means you have crossed the limit.
Back to top
View user's profile Send private message
Charles Wolters

New User


Joined: 30 Mar 2011
Posts: 48
Location: United States

PostPosted: Sat Feb 11, 2012 2:52 am
Reply with quote

Arjun,

I have been using Z/OS PKZIP lately and received the same error message as you did, but as Robert pointed out it was because I had NOT specified the transfer method of the zipped data set from mainframe to Windows as BINARY. One thing you may want to try is downloading a free copy of ZIPREADER (from PKZIP developer) to extract your data set once it is on your PC rather than WINZIP.

Charles Wolters
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 -> All Other Mainframe Topics

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 1
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
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top