Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Zipping a mainframe dataset using OSHELL Commands and FTP it

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> All Other Mainframe Topics
View previous topic :: :: View next topic  
Author Message
raviyuvi

New User


Joined: 31 Aug 2018
Posts: 5
Location: India

PostPosted: Thu Sep 06, 2018 7:13 pm    Post subject: Zipping a mainframe dataset using OSHELL Commands and FTP it
Reply with quote

Hi All,

I have a requirement where i have to Zip a Mainframe dataset and FTP it.I have seen many posts in this forum using PKZIP or ZIP. My requirement is to use the OSHELL commands and Zip it. This is the Breif intro.

Going Deeply into it.
Firstly, The steps are i have to copy large amount of data from Mainframe dataset to file which is in Z/OS UNIX path. The file present in Z/OS UNIX path has to be zipped using OSHELL commands and that zipped file has to be sent through FTP mechansim.

I have written the entire JCL. There are no errors while running it. File is being sent through FTP but they are unable to Unzip it.(error is testout.bz2 is not a zip file)

I will post my JCL. Could any one guide me on this issue.
Code:

//IDSZIPMF JOB (000000),'IDS ZIP',                           
//             CLASS=8,MSGCLASS=J,REGION=0M,RESTART=*,       
//             MSGLEVEL=(1,1)                                 
//COMP001  EXEC PGM=IKJEFT01                                 
//STEPLIB  DD DSN=MEBPROD.LOAD.LIB,DISP=SHR                   
//SYSTSPRT DD SYSOUT=*                                       
//O1       DD PATH='/testoptecon/opteconib.sh',               
//            PATHOPTS=(OCREAT,OTRUNC,OWRONLY),PATHMODE=SIRWXU
//I1       DD DISP=SHR,DSN=ITPAT.NAVEEN01.INPUT               
//SYSTSIN  DD *                                               
OCOPY INDD(I1) OUTDD(O1) TEXT CONVERT((BPXFXCIB)) FROM1047   
/*                                                           
//COMP002  EXEC PGM=IKJEFT01,REGION=2M                       
//SYSEXEC  DD DSN=SYS1.SBPXEXEC,DISP=SHR                     
//SYSTSPRT DD SYSOUT=*                                       
//SYSTSIN  DD *                                               
OSHELL chown -R 340:341 /testoptecon/opteconib.sh             
OSHELL ls -l /testoptecon/opteconib.sh                       
OSHELL bzip2 /testoptecon/opteconib.sh                       
OSHELL ls -l /testoptecon/opteconib.sh.bz2                   
/*                                                           
//COMP003  EXEC PGM=IKJEFT01                                 
//STEPLIB  DD DSN=MEBPROD.LOAD.LIB,DISP=SHR                   
//SYSTSPRT DD SYSOUT=*                                       
//O1       DD DSN=ITPAT.NAVEEN01.BASOUT,                     
//            DISP=(NEW,CATLG,CATLG),                       
//            SPACE=(TRK,(1000,100),RLSE),                   
//            DCB=(RECFM=FB,LRECL=4092,BLKSIZE=0)           
//I1       DD PATH='/testoptecon/opteconib.sh.bz2',         
//SYSTSIN  DD *                                             
 OCOPY INDD(I1) OUTDD(O1) TEXT CONVERT((BPXFXCIB)) FROM1047 
/*                                                           
//FTP01    EXEC  PGM=FTP,PARM='RS130A (EXIT TIMEOUT 600',   
//             REGION=2M                                     
//SYSFTPD  DD  DSN=TCP.SYSBN1.TCPPARMS(FTCDATA),DISP=SHR     
//SYSTCPD  DD  DSN=TCP.SYSBN1.TCPPARMS(TCPDATA),DISP=SHR     
//SYSPRINT DD  SYSOUT=*,                                     
//             DCB=BLKSIZE=133                               
//SYSMDUMP DD  SYSOUT=*                                     
//OUTPUT   DD  SYSOUT=*                                     
//*NETRC    DD  DISP=SHR,DSN=ITPAT.TCP.NETRC.DEBT.FDATA     
//INPUT DD *                                                 
dsadm d@t@st@ge08                                           
CD /datastage/FI/DEBT_MGMT/ST/Source/BILLIT/                 
LOCSITE SBD=TCP.PND.TCPXLBIN                                 
PUT 'ITPAT.NAVEEN01.BASOUT'   +                             
    testout1.bz2                                             
CLOSE                                                       
QUIT


Please learn to use the code tags when posting
Code:
[code]
Your stuff
here
[/code]
Back to top
View user's profile Send private message

raviyuvi

New User


Joined: 31 Aug 2018
Posts: 5
Location: India

PostPosted: Fri Sep 07, 2018 9:55 am    Post subject: Reply to: Zipping a mainframe dataset using OSHELL Commands and FTP it
Reply with quote

Sorry Enrico-sorichetti, I am new to this forum. I am not getting this RTFM or STFW. Could you tell me in a detailed way.

Quote:
will a kind soul move the topic to the stupid questions section please

This felt me very bad.
Back to top
View user's profile Send private message
raviyuvi

New User


Joined: 31 Aug 2018
Posts: 5
Location: India

PostPosted: Fri Sep 07, 2018 10:29 am    Post subject: Reply to: Zipping a mainframe dataset using OSHELL Commands and FTP it
Reply with quote

Cool....... I will post in the beginners forum.
Back to top
View user's profile Send private message
raviyuvi

New User


Joined: 31 Aug 2018
Posts: 5
Location: India

PostPosted: Sat Sep 08, 2018 9:01 am    Post subject:
Reply with quote

Thankyou enrico-sorichetti. You are the only person responding to my query. I feel very happy for that and sorry for misunderstanding you. Coming to the query..... I will explain in a detailed way. See my JCL parallely along with my explaination.

I didnot use any utility.. In COMP001 step, I am trying to copy data from Mainframe dataset to Z/os file. To verify if the data has copied or not, we will have to check that Z/os file but when iam going to z/os directory the file is missing its not there.


In COMP002 step, I used oshell commands. after this step .bz2 file is created in directory with some characters.(it is not understandable).

In COMP003 step, I am copying this .bz2 content into mainframe dataset because in the next step i have to FTP it.

In FTP01 step, I am sending this mainframe dataset to particular server as a zip file(put 'mainframe dataset' testout.bz2)

.bz2 is a zip format file
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2090
Location: UK

PostPosted: Sat Sep 08, 2018 2:27 pm    Post subject: Reply to: Zipping a mainframe dataset using OSHELL Commands and FTP it
Reply with quote

Just because a file has a file extension used to indicate that it is zipped does not mean that file is in fact zipped. It needs to be put through a compression program to zip it and the coresponding de-compression program to unzip it.

I can rename all my *.bat files to *.zip but they are not zip files as we understand the term - they are still plain text files with a misleading file name.
Back to top
View user's profile Send private message
enrico-sorichetti

Senior Member


Joined: 14 Mar 2007
Posts: 10515
Location: italy

PostPosted: Sat Sep 08, 2018 3:21 pm    Post subject:
Reply with quote

raviyuvi
I DO NOT NEED ANY EXPLANATION ...
the process is pretty clear

Code:
OSHELL bzip2 /testoptecon/opteconib.sh     


is it so difficult to understand that ...

bzip2 compresses into bzip2 compressed files and per general agreement the result has a bz2 extension
zip compresses zip compressed files and per general agreement the result has a zip extension

bunzip2 ( bzip2 -d ) decompresses bzip2 compressed files
unzip decompresses zip compressed files

the bzip2 and zip algorithms are different so ...
unzip does not understand bzip2 compressed files
bunzip2 does not understand zip compressed files

and bzip2,zip,bunzip2,unzip are the things I generically called utilities

YOU REALLY NEED TO MIGRATE TO THE BEGINNERS FORUM

please Nic lock the topic, it is going down the sink

PS.

unfortunately editing the stating post
the section about the error received when &unzipping was dropped
which made the rest of the posts appear illogic

also I am not sure if the OCOPY thing did not break things further
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2090
Location: UK

PostPosted: Sat Sep 08, 2018 5:44 pm    Post subject: Reply to: Zipping a mainframe dataset using OSHELL Commands and FTP it
Reply with quote

I will wait until the weekend (my weekend, that is, which starts on a Monday) before I take any action to see if there is any follow-up/thanks from raviyuvi.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2090
Location: UK

PostPosted: Mon Sep 10, 2018 1:47 pm    Post subject: Reply to: Zipping a mainframe dataset using OSHELL Commands and FTP it
Reply with quote

A further note: I suspect that sending the compressed data back to zOS is screwing the data up as it is not being transferred as binary (which it now is after compression). Why not just FTP from OMVS?
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1614
Location: Oregon

PostPosted: Mon Sep 10, 2018 10:33 pm    Post subject:
Reply with quote

enrico-sorichetti wrote:


bunzip2 ( bzip2 -d ) decompresses bzip2 compressed files

the bzip2 and zip algorithms are different so ...
unzip does not understand bzip2 compressed files
bunzip2 does not understand zip compressed files

and bzip2,zip,bunzip2,unzip are the things I generically called utilities

YOU REALLY NEED TO MIGRATE TO THE BEGINNERS FORUM

please Nic lock the topic, it is going down the sink

also I am not sure if the OCOPY thing did not break things further


This is not correct, Winrar, Winzip, 7zip and most tools all support BZ2 files. So you can't say "unzip does not understand bzip2 compressed files"
The file(dataset) that was zipped with bzip2 should work fine.

The problem has got to do with the binary as Nic suggested.
Back to top
View user's profile Send private message
enrico-sorichetti

Senior Member


Joined: 14 Mar 2007
Posts: 10515
Location: italy

PostPosted: Mon Sep 10, 2018 11:02 pm    Post subject: Reply to: Zipping a mainframe dataset using OSHELL Commands and FTP it
Reply with quote

my answer and comment was based on the content of the original post,

the TS spoke about good old plain zip, without telling the platform

and my answer was based on that.

and already I expressed my concern about the OCOPY thing.

so unless the TS comes back telling exactly what product he is using we can only guess

the behaviour of the free zip ( at least the zip used on apple and linux )
is a bit odd ...
trying to unzip an .xz or a .bz2 or a text file it told only about the end of sighature missing
trying to unzip an executable it added that the source could be an executable
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8390
Location: Dubuque, Iowa, USA

PostPosted: Mon Sep 10, 2018 11:46 pm    Post subject:
Reply with quote

Quote:
In FTP01 step, I am sending this mainframe dataset to particular server as a zip file(put 'mainframe dataset' testout.bz2)
Actually, no you are not. A zip file -- be it .zip or .gz or .bz2 or whatever -- is a binary file and hence must be transferred using binary (or IMAGE). Your FTP command does NOT set the mode to binary nor image before doing the PUT subcommand. Hence what you received on the other server was a binary .bz2 file that went through the EBCDIC to ASCII translation, so it is no longer a bz2 file (even though it may still have the .bz2 extension). It is a hybrid and hence is not likely to be readable by any program anywhere.
Back to top
View user's profile Send private message
raviyuvi

New User


Joined: 31 Aug 2018
Posts: 5
Location: India

PostPosted: Tue Sep 11, 2018 10:21 am    Post subject:
Reply with quote

Quote:
A further note: I suspect that sending the compressed data back to zOS is screwing the data up as it is not being transferred as binary (which it now is after compression). Why not just FTP from OMVS?


Imagine that i have not sent the compressed data to zos(i.e omittting step COMP003). Then how could i directly FTP a .bz2 file.

PUT filename.bz2

does that statement work???
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8390
Location: Dubuque, Iowa, USA

PostPosted: Tue Sep 11, 2018 5:19 pm    Post subject:
Reply with quote

Yes -- AS LONG AS you have issued FTP subcomand BINARY before doing the PUT. If you don't switch to image mode, and the FTP is going from a Windows / Linux / Unix machine, ASCII to EBCDIC conversion will occur and the .bz2 file on the mainframe will be completely unreadable.
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 -> All Other Mainframe Topics All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Open source project on mainframe agkshirsagar General Talk & Fun Stuff 3 Tue Sep 18, 2018 1:17 am
No new posts What is the purpose of z/OS dataset e... vasanthz All Other Mainframe Topics 3 Fri Aug 31, 2018 12:56 am
No new posts FILE versus DATASET jerryte All Other Mainframe Topics 9 Fri Jun 29, 2018 10:47 pm
No new posts Question about dataset sequence numbe... harisukumaran JCL & VSAM 23 Tue May 29, 2018 9:31 am
No new posts Transfer of mainframe file to PC in Z... maxsubrat JCL & VSAM 4 Thu May 17, 2018 11:35 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us