Zip the File on Mainframe and send as E-Mail Attachment
Moderators: Frank Yaeger, DikDude, Moderator Group
Zip the File on Mainframe and send as E-Mail Attachment
Hi,
My Req is to send an E-mail with an Zipped Excel attachment from Mainframe. i.e. Convert the PS File on Mainframe to Excel file on Mainframe and then Zip it and send it as attachment.
Iam able to convert the PS File into an Excel format file on Mainframe using SAS ODS feature. But not able to Zip it. I have PKZIP Installed on the machine.
//PKZIP EXEC PGM=PKZIP,REGION=0M
//SYSPRINT DD SYSOUT=*
//ZIPCUR DD DSN=XXXX.ABCD.EGFT,DISP=SHR
//OUTARCH DD DSN=XXXX.ABCD.EGFT.ZIP,DISP=(NEW,CATLG,DELETE),
// DCB=(LRECL=8196,BLKSIZE=27998,RECFM=VB),UNIT=SYSALLDA
//SYSIN DD *
-ECHO
-ADD
-NOPATH
-ARCHOUTDD(OUTARCH)
-INDD(ZIPCUR)
//*
Then send the Zip file as below using IEBGENER
MIME-VERSION: 1.0
CONTENT-TYPE: TEXT/XML
CONTENT-DISPOSITION: ATTACHMENT; FILENAME=REPORT.ZIP
I got a Zip file as attachment. But it gives the error on opening it to Unzip.
CANNOT OPEN FILE: IT DOES NOT APPEAR TO BE A VALID ARCHIVE
Looks like the problem is with the Zip file on Mainframe and not with the E-Mail step. As the same error appears when i FTP the Zippped file to Windows and try Unzipping it.
Can anyone please let me know what parameters are to be added to properly Zip the file. And what should be the CONTENT-TYPE provided in the E-Mail step (Using IEBGENER or SAS)?
Thanks.
My Req is to send an E-mail with an Zipped Excel attachment from Mainframe. i.e. Convert the PS File on Mainframe to Excel file on Mainframe and then Zip it and send it as attachment.
Iam able to convert the PS File into an Excel format file on Mainframe using SAS ODS feature. But not able to Zip it. I have PKZIP Installed on the machine.
//PKZIP EXEC PGM=PKZIP,REGION=0M
//SYSPRINT DD SYSOUT=*
//ZIPCUR DD DSN=XXXX.ABCD.EGFT,DISP=SHR
//OUTARCH DD DSN=XXXX.ABCD.EGFT.ZIP,DISP=(NEW,CATLG,DELETE),
// DCB=(LRECL=8196,BLKSIZE=27998,RECFM=VB),UNIT=SYSALLDA
//SYSIN DD *
-ECHO
-ADD
-NOPATH
-ARCHOUTDD(OUTARCH)
-INDD(ZIPCUR)
//*
Then send the Zip file as below using IEBGENER
MIME-VERSION: 1.0
CONTENT-TYPE: TEXT/XML
CONTENT-DISPOSITION: ATTACHMENT; FILENAME=REPORT.ZIP
I got a Zip file as attachment. But it gives the error on opening it to Unzip.
CANNOT OPEN FILE: IT DOES NOT APPEAR TO BE A VALID ARCHIVE
Looks like the problem is with the Zip file on Mainframe and not with the E-Mail step. As the same error appears when i FTP the Zippped file to Windows and try Unzipping it.
Can anyone please let me know what parameters are to be added to properly Zip the file. And what should be the CONTENT-TYPE provided in the E-Mail step (Using IEBGENER or SAS)?
Thanks.
I can't help you with the PKZIP step unless you want to include some error messages or anything else that might help.
As far as using MIME for the attachment, I'm pretty sure a binary file would be coded as:
Content-Type: multipart/mixed;
or possibly:
Content-Type: application/zip;
Now, I'm no MIME expert, and you can look this up just as easily as I can, but I think that you have to encode the attachment using BASE64 encoding. If I recall, SAS will properly encode the attachment without you needing to do anything special.
As far as using MIME for the attachment, I'm pretty sure a binary file would be coded as:
Content-Type: multipart/mixed;
or possibly:
Content-Type: application/zip;
Now, I'm no MIME expert, and you can look this up just as easily as I can, but I think that you have to encode the attachment using BASE64 encoding. If I recall, SAS will properly encode the attachment without you needing to do anything special.
Thank You.
There are no Error Messages in the PKZIP Step Spool.
-ECHO
-ADD
-ACTION(ADD)
-NOPATH
-PATH(N)
-ARCHOUTDD(OUTARCH)
ZPDA000I DSNAME=XXXX.XXXX.XXXX.CSV.ZIP,DISP_STATUS=NEW
ZPDA000I DISP_NORMAL=CATALOG,DISP_ABNORMAL=,SPACE_TYPE=TRK
ZPDA000I SPACE_TYPE=CYL,SPACE_TYPE=BLK,SPACE_PRIMARY=4194304
ZPDA000I SPACE_DIRBLKS=2097166,INFO_ALCFMT=00,VOLUMES=PRMH05,INFO_CNTL=
ZPDA000I INFO_STORCLASS=,INFO_MGMTCLASS=,INFO_DATACLASS=
ZPDA000I INFO_VSAMRECORG=00,INFO_VSAMKEYOFF=0,INFO_COPYDD=,INFO_COPYMDL=
ZPDA000I INFO_AVGRECU=20,INFO_DSTYPE=40,GETHFSPATH,HFS_OPTIONS=0
ZPDA000I HFS_ACCESS=0,HFS_DISP=,HFS_ABDISP=,HFS_ORG=DELIMITED
-INDD(ZIPCUR)
ZPAM030I OUTPUT Archive opened: XXXX.XXXX.XXXX.CSV.ZIP
ZPAM253I ADDED File XXXX.XXXX.XXXX.CSV
ZPAM254I as CSV
ZPAM255I (DEFLATED 95%/95%) DATA SIZE 379,907; ZIP SIZE 20,366
ZPAM140I FILES: ADDED EXCLUDED BYPASSED IN ERROR COPIED
ZPAM140I 1 0 0 0 0
ZPMT002I PKZIP processing complete. RC=00000000 0(Dec)
Hope this provides some Inputs..
Please let me know if anything missing/wrong in this...
There are no Error Messages in the PKZIP Step Spool.
-ECHO
-ADD
-ACTION(ADD)
-NOPATH
-PATH(N)
-ARCHOUTDD(OUTARCH)
ZPDA000I DSNAME=XXXX.XXXX.XXXX.CSV.ZIP,DISP_STATUS=NEW
ZPDA000I DISP_NORMAL=CATALOG,DISP_ABNORMAL=,SPACE_TYPE=TRK
ZPDA000I SPACE_TYPE=CYL,SPACE_TYPE=BLK,SPACE_PRIMARY=4194304
ZPDA000I SPACE_DIRBLKS=2097166,INFO_ALCFMT=00,VOLUMES=PRMH05,INFO_CNTL=
ZPDA000I INFO_STORCLASS=,INFO_MGMTCLASS=,INFO_DATACLASS=
ZPDA000I INFO_VSAMRECORG=00,INFO_VSAMKEYOFF=0,INFO_COPYDD=,INFO_COPYMDL=
ZPDA000I INFO_AVGRECU=20,INFO_DSTYPE=40,GETHFSPATH,HFS_OPTIONS=0
ZPDA000I HFS_ACCESS=0,HFS_DISP=,HFS_ABDISP=,HFS_ORG=DELIMITED
-INDD(ZIPCUR)
ZPAM030I OUTPUT Archive opened: XXXX.XXXX.XXXX.CSV.ZIP
ZPAM253I ADDED File XXXX.XXXX.XXXX.CSV
ZPAM254I as CSV
ZPAM255I (DEFLATED 95%/95%) DATA SIZE 379,907; ZIP SIZE 20,366
ZPAM140I FILES: ADDED EXCLUDED BYPASSED IN ERROR COPIED
ZPAM140I 1 0 0 0 0
ZPMT002I PKZIP processing complete. RC=00000000 0(Dec)
Hope this provides some Inputs..
Please let me know if anything missing/wrong in this...
Dear All,
Am having the same issue now (Stated above). My requirement is also a similar one. I need to zip one file and have to send it as a attachment in email.
Can anyone help me in this? searched a lot, but couldn't find the solution for the same.
Hi Natarajan, If possible can you guide me please? Am successful to send it as an attachment in .txt format. But facing issue here.
Thanks a lot,
Bharani.S
Am having the same issue now (Stated above). My requirement is also a similar one. I need to zip one file and have to send it as a attachment in email.
Can anyone help me in this? searched a lot, but couldn't find the solution for the same.
Hi Natarajan, If possible can you guide me please? Am successful to send it as an attachment in .txt format. But facing issue here.
Thanks a lot,
Bharani.S
What issue? We cannot help much if you do not provide the informaton necessary to help you. . .Am successful to send it as an attachment in .txt format. But facing issue here.
Post the jcl, control statements, and diagnostic info (including message ids) frlom the problem run.
You also replied to a dormant topic. It is best to start a new topic when posting a new (even though related) question.
Have a good one
Thank you DikDude, i have posted a seperate topic on this. Also provided some details on this. Could you please help me on this?
new post : http://www.mainframegurukul.com/ibmmain ... ght=#16641
Thanks,
Bharani.S
new post : http://www.mainframegurukul.com/ibmmain ... ght=#16641
Thanks,
Bharani.S
FREE TUTORIALS
Tutorials
Free tutorials from mainframegurukul
- JCL Tutorial
Covers all important JCL concepts. - Cobol Tutorial
This tutorials covers all Cobol Topics from STRING to COMP-3. - DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. - SORT Tutorial
This Tutorial covers all important aspects of DFSORT with examples - CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions
- Cobol Interview Questions
50+ Interview Questions - JCL Interview Questions
50+ Interview Questions - DB2 Interview Questions
100+ Interview Questions - CICS Interview Questions
70+ Interview Questions - VSAM Interview Questions
27 Interview Questions
Other References
Mainframe Tools and others
- XPEDITER Reference
Explains how we can debug a program - FILEAID Reference
Explains how to browse , edit and delete datasets - Change Man Reference
Quick Start tutorial on Changeman - Abend Reference
Important Abend codes explained - FaceBook Page
MainframeGurukul FaceBook Page - LinkedIn Page
MainframeGurkul Linkedin Page