Unziping file from Windows environment

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

Lucky
Participant
Posts: 31
Joined: Mon Oct 10, 2005 11:05 pm

Unziping file from Windows environment

Post by Lucky »

Hi Gurus,

I want to Unzip files which are in specified directory using routine or someother way (and once Unzipping is done next job will extract those files). If anyone have idea about on this pl guide me.

Both DataStage client and Server are installed in Windows environment.

Kind Regards
Luk
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Try before/after routine call to ExecDOS and use the zip/unzip command line program. Or, use a Command stage in a Sequence.
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
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

You can also use the routine activity stage in a sequence job to call the custom routine that unzips the files. This way you can control the execution incase the unzipping is unsuccessful.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Lucky
Participant
Posts: 31
Joined: Mon Oct 10, 2005 11:05 pm

Post by Lucky »

Thanks Kenneth Bland AND DSguru2B for the response,

DSguru2B will u pl help me in how can i Zip/Unzip files through routine.
Thanks in Advance
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Don't even attempt it. It's an additional and unnecessary layer because, in the routine, you'd be invoking the appropriate operating system command (via DSExecute()).

Use an Execute Command activity in a job sequence, or use a before-job subroutine, either ExecDOS or ExecDOSSilent or a clone of either.

Or use a filter command in a Sequential File stage to perform the unzip; the output of that command is picked up by the Sequential File stage.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Kirtikumar
Participant
Posts: 437
Joined: Fri Oct 15, 2004 6:13 am
Location: Pune, India

Post by Kirtikumar »

Wanted to know one thing - Can it be done using command filters available in seq file stage?
Regards,
S. Kirtikumar.
Lucky
Participant
Posts: 31
Joined: Mon Oct 10, 2005 11:05 pm

Post by Lucky »

Hi Ray,

Thanks for the response.....

I m executing following command to Unzip files from Before job subroutine

d:\progra~1\winzip\winzip32.exe -min -e c:\File_Name.zip c:\

Here c:\ is my source file path and i want to keep the unzipped file in the same path itself .

When i execute above command, i m getting the following error message (From director)

Test11..BeforeJob (ExecDOS): Error when executing command: d:\progra~1\winzip\winzip32.exe -min -e
*** No output from command ***

Job stopped - before-job routine returned error: Error 1 returned from BEFORE routine DSU.ExecDOS


Can anyone tell me is there anything wrong in my command....and Pl correct me

Thanks in Advance

Regards
Luk
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

What happens if you force some output, i.e. add "| dir" to your command line?
Lucky
Participant
Posts: 31
Joined: Mon Oct 10, 2005 11:05 pm

Post by Lucky »

Hi ArndW ,
I did't get exactly , i.e. add "| dir" to your command line?If possible If possible Will u pl explain me ..

Regards
Luk
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Currently your DOS command is "d:\progra~1\winzip\winzip32.exe -min -e c:\File_Name.zip c:\ ", I wanted to have this command force some sort of text into the buffer, so I wondered what would happen if you changed that to "d:\progra~1\winzip\winzip32.exe -min -e c:\File_Name.zip c:\ | dir"
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Examine the source code for ExecDOS. It requires that there be some output from the command. Arnd's suggestion, of adding a dir command, forces there to be some output. A hostname command or a cd command (with no command line arguments) would have done as well.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

I was under the impression that multiple files need to be unzipped and hence i advised to go for a routine where a substantial amount of error handling can be coded. But if the unzipping is for a single file then yes, no need for a routine.
Regards,
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Lucky
Participant
Posts: 31
Joined: Mon Oct 10, 2005 11:05 pm

Post by Lucky »

After appending " | dir " to the command "d:\progra~1\winzip\winzip32.exe -min -e c:\File_Name.zip c:\", the problem still remains.

As I understand, the command "d:\progra~1\winzip\winzip32.exe -min -e c:\File_Name.zip c:\ |dir" actually opens the winzip32.exe but the unzipping process is not happening.

When I killed the WINZIP32.exe process in Task Manager, the process returned CODE = 0 which means the command has unzipped the file.
But actually the unzipping process has never really happened.

A simple command like copy works fine but when I tried to execute unzip, postie commands via DS, the routine simply hangs...

Any idea if I am missing out on something????
Lucky
Participant
Posts: 31
Joined: Mon Oct 10, 2005 11:05 pm

Post by Lucky »

Hello All,

Any idea about this problem???

We are using
DataStage version 7.1,
O/S: Windows 2000,
WinZIP version: 9.0 with command line support.

If anyone has ever tried this one, please let me know how to go about this problem.

I have tried all the options

1. Calling ExecDOS in before Job Routine by passing the command as the input value
2. Using the Execute command stage in a sequence job
3. Passing the command as parameter to the Filter Command in Sequential File Stage after checking the option "Stage uses filter commands"

But none of them worked for me...
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

If I recall my WinZip correctly, you cannot use the normal executable from the command line but need to download the command-line version of the code (available on their website); I've used that from DOS before with no problems but can't recall what the executable is called, but I don't think that it is WinZip32.exe.

Doesn't it make sense to test the command line version directly to make sure that it works before trying it from inside of DataStage?
Post Reply