Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

ZIPPing two files into a single files using PKZIP in Cobol.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
HXSRSH

New User


Joined: 22 Jun 2006
Posts: 1

PostPosted: Thu Feb 27, 2014 12:14 am    Post subject: ZIPPing two files into a single files using PKZIP in Cobol.
Reply with quote

I have a small requirement in my current project. I got to know that we can do that using PKZIP but I am not able to use it effectively to get the results what we expected. Please find the below requirement and let us know your solution. Thanks in advance.

We will receive few file names in a PS file as below. We need to ZIP two files into one file and need to Send the ZIP file to email as attachment.

Data In Input File:
HXSRSH.INS2000.FIN1995.DATFILE INS_FIN1995_FILE.txt
HXSRSH.INS2000.FIN1995.CNTFILE INS_FIN1995_CNT.txt
HXSRSH.INS2000.FIN1996.DATFILE INS_FIN1996_FILE.txt
HXSRSH.INS2000.FIN1996.CNTFILE INS_FIN1996_CNT.txt
HXSRSH.INS2000.FIN1997.DATFILE INS_FIN1997_FILE.txt
HXSRSH.INS2000.FIN1997.CNTFILE INS_FIN1997_CNT.txt

The data in the file is like Mainframe File name and PC file name in a row. The first row is a data file and second row is a count file and it continues.

We need read this file in COBOL program and need to ZIP both data file and count file with the proposed file names into one file and need to send the zipped file to email as attachment as described below.

Both files HXSRSH.INS2000.FIN1995.DATFILE with name INS_FIN1995_FILE.txt and HXSRSH.INS2000.FIN1995.CNTFILE with name INS_FIN1995_CNT.txt into a zip file HXSRSH.INS2000.FIN1995.ZIP file using PKZIP and convert the Zip file into Base 64 file then we need to mail the BASE 64 file to email as attachment with name FIN1995_DATA.ZIP. And it continues will end of file.

After receiving the zip file FIN1995_DATA.ZIP as attachment. When we unzip the file FIN1995_DATA.ZIP using WINZIP/WINRAR in PC we need to have data in INS_FIN1995_FILE.txt and count in INS_FIN1995_CNT.txt files.

As I previously worked on the email part, I can perform it using IEBGENER simple boundary concept.

I am much concerned about ZIPPING PART.
• How to zip two mainframe files into a .zip mainframe file with PC file names.
• What are the parameters we need to pass to PKZIP to achieve the results.
• How to convert the .ZIP mainframe file to Base 64 mainframe file in Cobol program.

All this functionality we need to handle in Cobol program only.
Back to top
View user's profile Send private message

Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1609
Location: NY,USA

PostPosted: Thu Feb 27, 2014 1:33 am    Post subject:
Reply with quote

How to zip two mainframe files into a .zip mainframe file with PC file names

Code:
//JOBCARD
/*ROUTE XEQ PKZIP
//PS020 EXEC PGM=PKZIP,REGION=0M
//STEPLIB DD DISP=SHR,DSN=SYS1.PKZIP.LINKLIB
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//FILEIN DD DSN=INPUT.ZIP.VOL1,DISP=SHR
//FILEOUT DD DSN=OUT.ZIPPED.VOL1,
// DISP=(NEW,CATLG,DELETE)
//SYSIN DD DSN=input.parm(ZIPDAT),
// DISP=SHR




What are the parameters we need to pass to PKZIP to achieve the results

Code:
SYSIN DD DSN=input.parm(ZIPDAT),

-ARCHIVE_OUTFILE(FILEOUT)
-ARCHIVE_UNIT(SYSDA)
-ACTION(ADD)
-PATH(N)
-INFILE(FILEIN)   



How to convert the .ZIP mainframe file to Base 64 mainframe file in Cobol program.

Yes, you need to convert ANSCII to Binary before you use them on PC


Code:
//B64     EXEC PGM=IRXJCL,                           
//        PARM='WGM30564'                           
//SYSEXEC  DD DISP=SHR,DSN=XXXX.XXXX.XXXX.PRC   -> contain the rex code which is in the link 
[b]http://planetmvs.com/mvsmail/enbase64.txt  [/b]
//*                                                 
//SYSUT1   DD DISP=SHR,DSN=XXXX.XXXX.XXXX.FILE1  -> input file
//SYSUT2   DD DSN=&&BASE64,                         
//            DISP=(,PASS,),                         
//            UNIT=(TESTDA),VOL=(,,,99),             
//            SPACE=(CYL,(200),RLSE),               
//            DCB=(RECFM=FB,BLKSIZE=80)             
//SYSTSIN  DD DUMMY                                 
//SYSTSPRT DD SYSOUT=*                               
//*                        This is to send email                               
//SENDNOTE EXEC PGM=IEBGENER                             
//SYSPRINT DD SYSOUT=*                                   
//SYSIN    DD DUMMY                                       
//SYSOUT   DD SYSOUT=*                                   
//SYSUDUMP DD SYSOUT=D                                   
//SYSUT2   DD SYSOUT=(B,SMTP)                             
//SYSUT1   DD *         


See if this information helps, and let us know your progress.
Back to top
View user's profile Send private message
steve-myers

Active User


Joined: 30 Nov 2013
Posts: 460
Location: The Universe

PostPosted: Thu Feb 27, 2014 1:45 am    Post subject:
Reply with quote

HXSRSH: Do not, repeat, do not post the same topic in multiple forums. For the most part, the same people respond to requests in all the forums, and they will not respond to common topics in multiple forums.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Feb 27, 2014 1:59 am    Post subject:
Reply with quote

Hello and welcome to the forum,

As mentioned, a topic should Not be posted multiple times in multiple places.

Many of us will just silently delete the duplicates . . .

Suggest you consider compressing the 2 into 1 file and then do the base 64 work.
Back to top
View user's profile Send private message
shiva_sripathi

New User


Joined: 10 Oct 2006
Posts: 1
Location: hyd

PostPosted: Thu Feb 27, 2014 4:40 pm    Post subject:
Reply with quote

Thanks Rohit for your reply.

We do have the same requirement. In the above mentioned process you are executing the PKZIP from JCL. We would like to call PKZIP in cobol program.

How we need to pass the parameters in cobol to call PKZIP.

From above example:
Data in file HXSRSH.INS2000.FIN1995.DATFILE need to copy into INS_FIN1995_FILE.txt and Data in file HXSRSH.INS2000.FIN1995.CNTFILE need to copy into with name INS_FIN1995_CNT.txt and both files need to be zipped into a file HXSRSH.INS2000.FIN1995.ZIP. Then we can convert into BASE64 and we will mail it.

Thank you.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7905
Location: Bellevue, IA

PostPosted: Thu Feb 27, 2014 6:12 pm    Post subject:
Reply with quote

You need to find the PKZIP for MVS Data Compression Library manual for your release of PKZIP for MVS. This manual includes sample code in COBOL to call PKZIP and the various options possible. If your site has a license for PKZIP for MVS, you have access to the manuals -- via hardcopy, or via internal web page for your site, or via the vendor.
Back to top
View user's profile Send private message
Ramsee

New User


Joined: 06 Jan 2011
Posts: 52
Location: Chennai

PostPosted: Wed Mar 12, 2014 7:34 pm    Post subject: Reply to: ZIPPing two files into a single files using PKZIP
Reply with quote

Hi All,

Sorry for the late reply.
I would suggest you to find which version you are using in your shop?
and please provide me your let me know your JOBLOG(XDC File).
basic way of executing them is as follows:
Code:

//PS0001   EXEC PGM=PKZIP             
//SYSPRINT DD SYSOUT=U                   
//SYSOUT   DD SYSOUT=U                   
//SYSUDUMP DD SYSOUT=V                   
//INPUT    DD DSN=HXSRSH.INS2000.FIN1995.DATFILE,DISP=SHR
//OUTPUT   DD DSN=HXSRSH.INS2000.FIN1995.DATFILE.ZIP,
//            DISP=(,CATLG,DELETE),       
//            SPACE=(CYL,(1,1),RLSE),     
//            DCB=(RECFM=U,BLKSIZE=27998)
//SYSIN    DD *                           
-ECHO                                     
-INDD(INPUT)                             
-ARCHOUTDD(OUTPUT)                       
-TEXT                                     
-PASSWORD(HXSRSH)                       
-NIA(HXSRSH.INS2000.FIN1995.DATFILE,INS_FIN1995_FILE.txt)       
/*


The reason i am asking you to furnish the XDC file is to verify the parameter and can suggest whether you can use the PKZIP via COBOL or not.

Note: -ZIIP_RUNOPTS(Y/N) is the key parameter that will decide you to use PKZIP via COBOL or explict call via JCL.

Once agian apologize for not helping you on time with this issue.

Kindly let me know you have any questions.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts Regarding COBOL Stored Procedure opti... selvamsrinivasan85 DB2 4 Fri Nov 04, 2016 8:57 pm
No new posts Two Selects in a single select query Rohit Umarjikar DB2 1 Fri Nov 04, 2016 8:46 pm
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us