UnZipping of files using Datastage

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
Kalyana Chakravarthy
Participant
Posts: 7
Joined: Tue Jun 20, 2006 3:53 am

UnZipping of files using Datastage

Post by Kalyana Chakravarthy »

I have a requirement where in need of unzip the files using Unix/through datastage execute command.

Please let me know is this possible and give me the syntax for that and properties related to this execute command activity.

Kalyan
Kalyanachakravarthy VS
keshav0307
Premium Member
Premium Member
Posts: 783
Joined: Mon Jan 16, 2006 10:17 pm
Location: Sydney, Australia

Post by keshav0307 »

use execute command

read the datastage online manual , designer guide
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Do you mean the Execute Command stage in a Sequence job? If so, you use the exact same syntax there that you would from the command line. Only wrinkle that comes in is if you need to use Job Parameters in the call, any such need to be in the Parameters prompt for them to be 'expanded' properly.
-craig

"You can never have too many knives" -- Logan Nine Fingers
battaliou
Participant
Posts: 155
Joined: Mon Feb 24, 2003 7:28 am
Location: London
Contact:

Post by battaliou »

If you unzip directly into a named pipe, you can read it directly as a sequential file without landing the data.
3NF: Every non-key attribute must provide a fact about the key, the whole key, and nothing but the key. So help me Codd.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Let's stay on topic here. So far this is just about unzipping with no mention of a need to read anything, nor that these are sequential files that are zipped up. Let's solve one problem before we introduce any new ones, ok? :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
owen3
Participant
Posts: 18
Joined: Mon Dec 17, 2007 8:27 pm

Post by owen3 »

Exec_Command_Stage-------------->Job_Activity

At ExecCommand\Command pass following unix command:

gzip -d /path_of_zipped_file/zipped_file_name
nash
Premium Member
Premium Member
Posts: 16
Joined: Thu May 03, 2007 10:26 am
Location: Seattle

read a specific file from .tar.gz and transform it on fly

Post by nash »

we need to parse and transform a .tar.gz file in memory. So I used a external source stage and tried to use the following command to tar, gzip and read a specific file inside the tar file.
tar -xzf xyz.tar.gz xx.tsv

Its not importing any records form it. The format is fine as I unzipped manually and then tried to import it. It works. So i used the same format with this command and it should wokr. But it isnt. Am I missing something??? Any suggestions please???? I need a solution asap. Thanks in advance.

More detail:

Need to untar (tar -xzf <tar_file> <specific file in tar>) only a specific file and then read & transform on the fly .

1: Using seq file to read.
2 : Using filter option in seq file stge and using the cmd (tar -xzf xyz.tar.gz xx.tsv)
3: not sure what to give in actual filename property

When i execute the job its not aborting but saying 0 rows imported/rejected.




battaliou wrote:If you unzip directly into a named pipe, you can read it directly as a sequential file without landing the data.
battaliou
Participant
Posts: 155
Joined: Mon Feb 24, 2003 7:28 am
Location: London
Contact:

Post by battaliou »

Ok, you need to direct the output of you tar to a named pipe. So create a named pipe called "np" by doing the following:

mkfifo np

When you're ready to run the job, simply go:
tar -xzf xyz.tar.gz xx.tsv > np

In datastage, your sequential file is called np and the data should stream through. You will need to run your job shortly after issuing the tar command, else the named pipe will time out.
3NF: Every non-key attribute must provide a fact about the key, the whole key, and nothing but the key. So help me Codd.
miwinter
Participant
Posts: 396
Joined: Thu Jun 22, 2006 7:00 am
Location: England, UK

Post by miwinter »

Couldn't you just use the Expand stage?
Mark Winter
<i>Nothing appeases a troubled mind more than <b>good</b> music</i>
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

If it was just gzipped, I would think so. The need to then extract a single file from the uncompressed tar archive is the extra wrinkle here.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply