Zip Seq file
Moderators: chulett, rschirm, roy
Zip Seq file
Hi All
Am getting Seq files in Zip format. The requirement is shd not unzip those files manually..shd have to be implemented in DataStage iteslf.
Any one advice me
Thanks
Joy
Am getting Seq files in Zip format. The requirement is shd not unzip those files manually..shd have to be implemented in DataStage iteslf.
Any one advice me
Thanks
Joy
-
- Participant
- Posts: 437
- Joined: Fri Oct 15, 2004 6:13 am
- Location: Pune, India
In the sequential file stages there is something called as command filter. You can use the command filter in the seq file stage to first uncompress the data and then use this uncopressed file in the file name for the stage. In the command filter you use the any decompression utility lie tar or gzip etc.
There is one more option - use a before job routine to do decompression.
There is one more option - use a before job routine to do decompression.
Regards,
S. Kirtikumar.
S. Kirtikumar.
As i said, the coding depends upon the type of zip it is
if its .tar then
if its .Z then
it its .gz then
These command(s) will go in the after job subroutine "ExecSh"
if its .tar then
Code: Select all
untar file.tar
Code: Select all
uncompress file.Z
Code: Select all
gzip -d file.gz
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Rather than seaking another route, why not just enable it? It's just a check box on the stage to light it up and start using it.joyson wrote:Here in my env the filter command is disabled.
Otherwise, you're back to writing Before Job routines or shell scripts and we all remember how much fun that is.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Have you read the Help associated with the Filter option? You can't just simply 'unzip' anything there, you need to find a way to provide the contents of all files to 'standard out' so the Sequential stage can read the stream of data as if it were a file.
If all you want to do is unzip something, do that before job or in a separate step.
If all you want to do is unzip something, do that before job or in a separate step.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
If multiple files are inside an archived file format, you are going to have a lot of trouble doing a simple uncompression into a Sequential stage.
The filter command has to return streaming output to a pipe, that's its mechanism. You have to uncompress but not to a file, but to stdout. Furthermore, you must also specify a single file to be uncompressed, if the archive holds multiple files you must be able to specify the one you need.
The boundaries for your task are suspect. You should simply uncompress the files and process them naturally using a Sequential stage. That's as much help as I'm willing to give, because I believe you should fight the directive to process as archives.
The filter command has to return streaming output to a pipe, that's its mechanism. You have to uncompress but not to a file, but to stdout. Furthermore, you must also specify a single file to be uncompressed, if the archive holds multiple files you must be able to specify the one you need.
The boundaries for your task are suspect. You should simply uncompress the files and process them naturally using a Sequential stage. That's as much help as I'm willing to give, because I believe you should fight the directive to process as archives.
Kenneth Bland
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Please see if the below code helps..I am doing something sinilar in a server routine...
inrec=Trim(Arg1)
len1=LEN(inrec)
len2=len1-2
file1=inrec[len2,3]
if (file1 = 'zip' or file1 = 'ZIP') then
ucom1 ='unzip /pathname'
ucom1=CATS(ucom1,inrec)
ucom1=CATS(ucom1," -d pathname")
CALL DSExecute('UNIX',ucom1,fil1,SYSRET)
ucom1 ='rm /pathname'
ucom1=CATS(ucom1,inrec)
CALL DSExecute('UNIX',ucom1,fil1,SYSRET)
end
You may need to modify the code a bit !! I am passinf the name of the file a an argument to the code..
inrec=Trim(Arg1)
len1=LEN(inrec)
len2=len1-2
file1=inrec[len2,3]
if (file1 = 'zip' or file1 = 'ZIP') then
ucom1 ='unzip /pathname'
ucom1=CATS(ucom1,inrec)
ucom1=CATS(ucom1," -d pathname")
CALL DSExecute('UNIX',ucom1,fil1,SYSRET)
ucom1 ='rm /pathname'
ucom1=CATS(ucom1,inrec)
CALL DSExecute('UNIX',ucom1,fil1,SYSRET)
end
You may need to modify the code a bit !! I am passinf the name of the file a an argument to the code..