JCL to send a e-mail with zip file attached

In this Mainframe Forum - You can post your queries on JCL, OS/390 JCL, MVS JCL, z/OS JCL, JES2 & JES3

Moderators: Frank Yaeger, DikDude, Moderator Group

Post Reply
Abhiyanta
Member
Posts: 7
Joined: Fri Mar 31, 2006 10:37 pm
Location: PUNE

JCL to send a e-mail with zip file attached

Post by Abhiyanta » Fri Mar 12, 2010 12:25 pm

Hi,

Please help me for JCL which is used to send a e-mail with ZIP file attached. Our corrent JCL is not working for zip file attachment.

//STEP02 EXEC PGM=IEBGENER
//SYSIN DD DUMMY
//SYSPRINT DD SYSOUT=*
//SYSUT2 DD SYSOUT=(B,TCPSMTP)
//SYSUT1 DD DISP=SHR,
// DSN=DPFCBP2.D381057.SOURCE(ABCCNTL)
// DD DSN=TEMP01.ZIP,DISP=(OLD,PASS)

User avatar
Natarajan
Moderator
Posts: 537
Joined: Fri Oct 10, 2008 12:57 pm
Location: chennai
Contact:

Post by Natarajan » Sat Mar 13, 2010 8:15 am

Please refer following thread. If you still has any questions, please post them here.

http://www.mainframegurukul.com/ibmmain ... php?t=3508
Natarajan
Chennai

CapZug
Member
Posts: 3
Joined: Wed Jul 18, 2012 4:52 pm
Location: Cincinnati

Post by CapZug » Wed Jul 18, 2012 4:59 pm

I read the (3) pages on the link above, but found nothing specific to sending a mainframe email with a zipped (*.zip) file attachment through SMTP. Could you please indicate here (in this thread) how to accomplish this? Thank you!

Anuj Dhawan
Moderator
Posts: 1625
Joined: Sat Aug 09, 2008 9:02 am
Location: Mumbai, India

Post by Anuj Dhawan » Wed Jul 18, 2012 6:49 pm

We don't encourage to tail-gate an old thread. Having said that, please show us what you've tried - was there any error?
Regards,
Anuj

CapZug
Member
Posts: 3
Joined: Wed Jul 18, 2012 4:52 pm
Location: Cincinnati

Post by CapZug » Wed Jul 18, 2012 7:18 pm

OK. Here is an entire email packet (except for the zipped data) which passes from the mainframe to our internal email server via SMTP:

helo SOMENODE
mail from:<johndoe@somedomain.com>
rcpt to:<johndoe@somedomain.com>
data
From:"John Doe"<johndoe@somedomain.com>
To:"John Doe"<johndoe@somedomain.com>
Subject: Test ZIP attachment from mainframe email
MIME-VERSION: 1.0
CONTENT-TYPE: MULTIPART/MIXED; BOUNDARY="SIMPLE BOUNDARY"

PROLOGUE - IGNORED

--SIMPLE BOUNDARY
CONTENT-TYPE: TEXT/HTML;

<HTML>
<HEAD>
<TITLE>mainframe email</TITLE>
</HEAD>
<BODY>
Test ZIP attachment from mainframe email, passing through SMTP.
<P>
</BODY>
</HTML>

--SIMPLE BOUNDARY
CONTENT-DISPOSITION: ATTACHMENT; FILENAME="somefile.zip"

<zipped data goes here>
.

The above packet is passed through SMTP using a simple IDCAMS step:

//S010 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//INFILE1 DD DSN=EMAIL.WITH.ZIPPED.ATTACH.MENT,DISP=SHR
//OUTFILE1 DD SYSOUT=[b](B,SMTP)[/b],
// DCB=(RECFM=VB,LRECL=01002,BLKSIZE=0,DSORG=PS)
//SYSIN DD *
REPRO IFILE(INFILE1) OFILE(OUTFILE1)
//*

If I FTP the zipped mainframe file to my workstation, I can unzip it fine. But... when the zipped file is sent through SMTP as an email attachment, any attempt to open the attachment via our internal email application causes a message box with the text:

[b]"The Compressed (zipped) Folder is invalid or corrupted."[/b]

NicC
Active Member
Posts: 650
Joined: Sun Jul 24, 2011 5:27 pm
Location: Down on the pig farm

Post by NicC » Wed Jul 18, 2012 8:27 pm

I believe ou have to send it as a binary file otherwise the transfer process will try and treat it as a text file and 'convert' it from EBCDIC to ASCII.
Regards
Nic

CapZug
Member
Posts: 3
Joined: Wed Jul 18, 2012 4:52 pm
Location: Cincinnati

Post by CapZug » Wed Jul 18, 2012 11:54 pm

Agreed. But... how to send the data as 'binary'? For example, I have tried this coding in the email packet (immediately before the zipped data) ...

--SIMPLE BOUNDARY
CONTENT-TYPE: APPLICATION/ZIP; NAME="somefile.zip"
CONTENT-DISPOSITION: ATTACHMENT; FILENAME="somefile.zip"
CONTENT-TRANSFER-ENCODING: BINARY

... without success. In fact, the "BINARY" parameter gets changed to "base64" after passing through SMTP. (I can see this by doing a 'view source' within our email application.) On the other hand, if I code "BASE64" or "base64" as the ENCODING parameter, the data is truncated after passing through SMTP.

We are using mainframe PKZIP/PKUNZIP in-house. It may be that I need a certain combination of "zip" parameters, but none of the ones I've tried work.

Post Reply

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



Other References
Mainframe Tools and others