Zip Seq file

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
joyson
Participant
Posts: 31
Joined: Wed Dec 08, 2004 5:59 am

Zip Seq file

Post by joyson »

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
Kirtikumar
Participant
Posts: 437
Joined: Fri Oct 15, 2004 6:13 am
Location: Pune, India

Post by Kirtikumar »

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.
Regards,
S. Kirtikumar.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Depending upon the what kind of zip it is (the extension, .tar, .Z or .gz) you will have to supply the proper command in the before job subroutine as KirtiKumar mentioned.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
joyson
Participant
Posts: 31
Joined: Wed Dec 08, 2004 5:59 am

Post by joyson »

Hi Kumar

Here in my env the filter command is disabled.Could you pls.. let me know with the coding for before job sub-routine

Thanks
Joy
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

As i said, the coding depends upon the type of zip it is
if its .tar then

Code: Select all

untar file.tar
if its .Z then

Code: Select all

uncompress file.Z
it its .gz then

Code: Select all

gzip -d file.gz
These command(s) will go in the after job subroutine "ExecSh"
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
joyson
Participant
Posts: 31
Joined: Wed Dec 08, 2004 5:59 am

Post by joyson »

Hi DSGuru
Thanks for your reply
Could you pls..tell me how to do this with Filter command

Thanks
Joy
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

joyson wrote:Here in my env the filter command is disabled.
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.

Otherwise, you're back to writing Before Job routines or shell scripts and we all remember how much fun that is. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
joyson
Participant
Posts: 31
Joined: Wed Dec 08, 2004 5:59 am

Post by joyson »

Now the filter command is enabled!
Then what to do for unzipping my SRC Seq files

Please advice

Thanks
Joy
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
joyson
Participant
Posts: 31
Joined: Wed Dec 08, 2004 5:59 am

Post by joyson »

Hi

I went through the filter command help , but i did't get any solution for the my requirement.
Can anyone advice me

Thanks
Joy
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

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.
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
dsscholar
Premium Member
Premium Member
Posts: 195
Joined: Thu Oct 19, 2006 2:45 pm

Post by dsscholar »

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..
Post Reply