How to zip the file and email that as an attachment in JCL

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
bharani
Member
Posts: 13
Joined: Fri Oct 09, 2009 2:47 am

How to zip the file and email that as an attachment in JCL

Post by bharani » Sat Aug 04, 2012 1:35 pm

Hi All,

Requesting your advice and help on the below issue.

Am having issue while sending the zip file as an attachment throught JCL.

I can zip the file using PKZIP (usually we use to FTP the zip file but now we got different request to mail those). Even i can mail the attachment. But am getting error while trying to open the zip file, copied to my desktop.

Error is : ' Invalid or unknown archive format '

I guess this is the issue while mailing the file. Below is the code am using to mai

ZIP Command we are using for PKZIP

Code: Select all

-TEXT                                               
-INDD(INPUT1)                                       
-ARCHOUTDD(OUTARCH1)                                
-NIA(xxxxx.xxxxx.xxxx.xxx.xx,RPT.TXT) 
-FILE_TERMINATOR()                   

SYSPRINT for zip

Code: Select all

ZPDA000I     HFS_ORG=-------                                          
-TEXT                                                                 
-DATA_TYPE(TEXT)                                                      
-INDD(INPUT1)                                                         
-ARCHOUTDD(OUTARCH1)                                                  
-NIA(xxxxx.xxxxx.xxxx.xxx.xx,RPT.TXT)                   
-FILE_TERMINATOR()                                                    
ZPAM030I OUTPUT Archive opened:  xxxx.xxxx.xxxx05W.xxxxPT.BKP0803    
ZPAM253I ADDED     File xxxxx.xxxxx.xxxx.xxx.xx            
ZPAM254I   as RPT.TXT                                              
ZPAM255I   (DEFLATED 84%/84%)  DATA SIZE 1,672,874; ZIP SIZE 274,334  
ZPAM140I FILES:       ADDED  EXCLUDED  BYPASSED  IN ERROR    COPIED   
ZPAM140I                  1         0         0         0         0   
ZPMT002I PKZIP processing complete. RC=00000000 0(Dec)                
For mailing

Code: Select all

//STEP01   EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*                                            
//SYSIN    DD DUMMY                                               
//SYSOUT   DD SYSOUT=*                                            
//SYSUDUMP DD SYSOUT=D                                            
//SYSUT2   DD SYSOUT=(B,SMTP)                                     
//*            WEEKLY ACTIVITY REPORT                             
//SYSUT1       DD DSN=xxxxx.xxxxx.xxx.ATTACH1,DISP=SHR         
//             DD DSN=xxxx.xxxx.xxxx05W.xxxxPT.BKP0803,DISP=SHR  
xxxxx.xxxxx.xxx.ATTACH1 contains the below one

Code: Select all

HELO SOUTH2                                     
MAIL FROM&#58;<XXXXX@XX.COM>   
RCPT TO&#58;<XXXXXX@XX.COM>            
DATA                                            
FROM&#58; Bharani       
TO&#58; "xxxxxx"                      
SUBJECT&#58; xxxxxxxxx
MIME-VERSION&#58; 1.0                               
CONTENT-TYPE&#58; MULTIPART/MIXED;BOUNDARY="MIME"   
                                                
--MIME                                          
CONTENT-TYPE&#58; TEXT/PLAIN; CHARSET=US-ASCII      
CONTENT-TRANSFER-ENCODING&#58; 7BIT                 
                                                
Hi,                                             
See the attached.

Thanks
                                               
--MIME                                         
CONTENT-TYPE&#58; TEXT/PLAIN;NAME=report.ZIP   
CONTENT-TRANSFER-ENCODING&#58; 7BIT                
CONTENT-DISPOSITION&#58; ATTACHMENT;               
FILENAME=xxxx.xxxx.xxxx05W.xxxxPT.BKP0803;            
Can anyone help me here please????

MrSpock
Active Member
Posts: 273
Joined: Wed Jun 27, 2007 5:37 pm

Post by MrSpock » Sat Aug 04, 2012 4:39 pm

Read the section "Sending binary files from MVS in a MIME attachment" and follow the example provided EXACTLY.

MVS Mail Page.

bharani
Member
Posts: 13
Joined: Fri Oct 09, 2009 2:47 am

Post by bharani » Mon Aug 06, 2012 7:33 pm

Hi MrSpock,

Thank you. But still am getting the same issue. But now am getting the error message as ZIP ARCHIVE INVALID. Below are the details

Code: Select all

//B64     EXEC PGM=IRXJCL,                           
//        PARM='WGM30564'                            
//SYSEXEC  DD DISP=SHR,DSN=XXXX.XXXX.XXXX.PRC   -> contain the rex code which is in the link  
&#91;b&#93;http&#58;//planetmvs.com/mvsmail/enbase64.txt  &#91;/b&#93;
//*                                                  
//SYSUT1   DD DISP=SHR,DSN=XXXX.XXXX.XXXX.FILE1  -> input file
//SYSUT2   DD DSN=&&BASE64,                          
//            DISP=&#40;,PASS,&#41;,                         
//            UNIT=&#40;TESTDA&#41;,VOL=&#40;,,,99&#41;,             
//            SPACE=&#40;CYL,&#40;200&#41;,RLSE&#41;,                
//            DCB=&#40;RECFM=FB,BLKSIZE=80&#41;             
//SYSTSIN  DD DUMMY                                  
//SYSTSPRT DD SYSOUT=*                               
//*                                                       
//SENDNOTE EXEC PGM=IEBGENER                              
//SYSPRINT DD SYSOUT=*                                    
//SYSIN    DD DUMMY                                       
//SYSOUT   DD SYSOUT=*                                    
//SYSUDUMP DD SYSOUT=D                                    
//SYSUT2   DD SYSOUT=&#40;B,SMTP&#41;                             
//SYSUT1   DD *                                                         
HELO SOUTH2                                                             
MAIL FROM&#58;<BHARANI@XXX.COM>                                 
RCPT TO&#58;<BHARANI@XXX.COM>                                 
DATA                                                                    
FROM&#58;     BHARANI@XXX.COM                                
TO&#58;       BHARANI@XXX.COM                                                           
SUBJECT&#58;  TEST MESSAGE FROM MVS USING SMTP &#40;WITH ZIP MIME ATT.&#41;         
MIME-VERSION&#58; 1.0                                                       
CONTENT-TYPE&#58; 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&#58; TEXT/PLAIN; CHARSET="US-ASCII"                            
CONTENT-TRANSFER-ENCODING&#58; 7BIT                                         
ATTACHED IS A ZIP FILE                                                  
------ =_NEXTPART_000_01BD3BAF.A762FD80                                 
CONTENT-TYPE&#58; APPLICATION/OCTET-STREAM; NAME="A.ZIP"                    
CONTENT-TRANSFER-ENCODING&#58; BASE64                                       
/*                                              
//         DD DISP=&#40;OLD,PASS&#41;,DSN=&&BASE64      
//         DD *                                 
------ =_NEXTPART_000_01BD3BAF.A762FD80--       
/*                                              
//*                                                       

In the SYSUT2

Code: Select all

HELO SOUTH2                                                                   
MAIL FROM&#58;<BHARANI@XXX.COM>                                 
RCPT TO&#58;<BHARANI@XXX.COM>                                   
DATA                                                                          
FROM&#58;     BHARANI@XXX.COM                                   
TO&#58;       BHARANI@XXX.COM                                   
SUBJECT&#58;  TEST MESSAGE FROM MVS USING SMTP &#40;WITH ZIP MIME ATT.&#41;               
MIME-VERSION&#58; 1.0                                                             
CONTENT-TYPE&#58; MULTIPART/MIXED; BOUNDARY="---- =_NEXTPART_000_01BD3BAF.A762FD80
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&#58; TEXT/PLAIN; CHARSET="US-ASCII"                                  
CONTENT-TRANSFER-ENCODING&#58; 7BIT                                               
ATTACHED IS A ZIP FILE                                                        
------ =_NEXTPART_000_01BD3BAF.A762FD80                                       
CONTENT-TYPE&#58; APPLICATION/OCTET-STREAM; NAME="A.ZIP"                          
CONTENT-TRANSFER-ENCODING&#58; BASE64                                           
8UBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQObF
09PX1snV40DH2dbk10Di6OLjxdTiQEDw2cXX1tnjQNXWekBA5sfU+PLx8fDyQEBAQEBAQMTB48V6
QEDw+GDw82Dx8kBAQEBAQEBAQEBAQObFxdLT6EDi4sJA2dbT09blxdlA2cXX1kBAQEBAQEBAQEBA
QEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQMLoekDX2cXlydbk
4kDX2dblycTF2WtA8MPW1NdA19nF5UBAQNnW09PW5cXZQMfZ1uTXQEBAQEBAycRA1dZAQEBAQEBA
QNTCQEBcXFxcXFxcXNTF1MLF2VxcXFxcXFxcQEDTxeNAQMlAw9bExUDX2dblQEBAxcbGQMTjxUBA
1eTUwsXZQEBAQEBAQEBAQEBAQEBAQEBAw8RAQEBAQEBAQEBA1cHUxUBAQEBAQEBAQEBAQOPF2UBA                                  
….
…
QEBAQEBAQEBAQEBA                                                             
------ =_NEXTPART_000_01BD3BAF.A762FD80--                                    
 
In SYSPRINT i can see

Code: Select all

DATA SET UTILITY - GENERATE                             
SYNCSORT COPY FEATURE CALLED - RC = 0                   

Could you please help me in this?

bharani
Member
Posts: 13
Joined: Fri Oct 09, 2009 2:47 am

Post by bharani » Tue Aug 07, 2012 10:14 am

Dear MrSpock,

yea, it worked well now. Thanks for providing me the steps with an example. It helped me.

Thanks a ton.
-Bharani :)

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