View previous topic :: View next topic
|
Author |
Message |
arjun.h
New User
Joined: 13 Jan 2012 Posts: 20 Location: India
|
|
|
|
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.
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
Have you tested with using a different encoding?
Have you tested with a multi-part MIME message? |
|
Back to top |
|
|
arjun.h
New User
Joined: 13 Jan 2012 Posts: 20 Location: India
|
|
|
|
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 |
|
|
arjun.h
New User
Joined: 13 Jan 2012 Posts: 20 Location: India
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
arjun.h
New User
Joined: 13 Jan 2012 Posts: 20 Location: India
|
|
|
|
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 |
|
|
arjun.h
New User
Joined: 13 Jan 2012 Posts: 20 Location: India
|
|
|
|
More information
The Zipped file has the following properties
Organization . . . : PS
Record format . . . : U
Record length . . . : 0
Block size . . . . : 27998 |
|
Back to top |
|
|
arjun.h
New User
Joined: 13 Jan 2012 Posts: 20 Location: India
|
|
|
|
Hello All,
if anyone has a working job that does the zip with PKZIP and then send the file through SMTP , Please post.
|
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1744 Location: Tirupur, India
|
|
|
|
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 |
|
|
superman
New User
Joined: 28 Mar 2011 Posts: 12 Location: india
|
|
|
|
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 |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1744 Location: Tirupur, India
|
|
|
|
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 |
|
|
superman
New User
Joined: 28 Mar 2011 Posts: 12 Location: india
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10888 Location: italy
|
|
Back to top |
|
|
arjun.h
New User
Joined: 13 Jan 2012 Posts: 20 Location: India
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10888 Location: italy
|
|
|
|
deleted...
I had not noticed that sending a zipped file thru SAS worked! |
|
Back to top |
|
|
arjun.h
New User
Joined: 13 Jan 2012 Posts: 20 Location: India
|
|
|
|
Enrico,
Yes SAS work fine. But whats with the JCL ?
I was able to send through SAS , its quite simple also. |
|
Back to top |
|
|
arjun.h
New User
Joined: 13 Jan 2012 Posts: 20 Location: India
|
|
|
|
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 |
|
|
Charles Wolters
New User
Joined: 30 Mar 2011 Posts: 48 Location: United States
|
|
|
|
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 |
|
|
|