View previous topic :: View next topic
|
Author |
Message |
raviyuvi
New User
Joined: 31 Aug 2018 Posts: 5 Location: India
|
|
|
|
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 |
|
|
raviyuvi
New User
Joined: 31 Aug 2018 Posts: 5 Location: India
|
|
|
|
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 |
|
|
raviyuvi
New User
Joined: 31 Aug 2018 Posts: 5 Location: India
|
|
|
|
Cool....... I will post in the beginners forum. |
|
Back to top |
|
|
raviyuvi
New User
Joined: 31 Aug 2018 Posts: 5 Location: India
|
|
|
|
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 |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
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 |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
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 |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
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 |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1742 Location: Tirupur, India
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
raviyuvi
New User
Joined: 31 Aug 2018 Posts: 5 Location: India
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
|