Page 1 of 2

Unziping file from Windows environment

Posted: Mon Sep 25, 2006 8:10 pm
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

Posted: Mon Sep 25, 2006 8:22 pm
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.

Posted: Mon Sep 25, 2006 9:40 pm
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.

Posted: Mon Sep 25, 2006 11:16 pm
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

Posted: Mon Sep 25, 2006 11:23 pm
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.

Posted: Tue Sep 26, 2006 12:37 am
by Kirtikumar
Wanted to know one thing - Can it be done using command filters available in seq file stage?

Posted: Tue Sep 26, 2006 2:54 am
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

Posted: Tue Sep 26, 2006 2:57 am
by ArndW
What happens if you force some output, i.e. add "| dir" to your command line?

Posted: Tue Sep 26, 2006 3:21 am
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

Posted: Tue Sep 26, 2006 3:27 am
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"

Posted: Tue Sep 26, 2006 6:41 am
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.

Posted: Tue Sep 26, 2006 12:32 pm
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,

Posted: Tue Sep 26, 2006 8:45 pm
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????

Posted: Wed Sep 27, 2006 12:44 am
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...

Posted: Wed Sep 27, 2006 1:21 am
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?