Page 1 of 1

extracting a zip file from a job

Posted: Sun Apr 02, 2006 7:29 pm
by vsi
Hi,

i have a zip file which will be created in a folder.
i need to watch for the zip file.
once,this zip file is existing in a folder, extract the files to a particular folder..
these extracted files are necessary for some other operations..

eg:
lets say i have folder called "Inbox"
at some period of time, a zip file is created in the folder "Inbox".

I need to watch for this zip file in "inbox" folder,extract files to some other folder.
all these are done before running a job.

my server is running on Unix.datastage client tools are on Windows.

i apologize for any spelling mistakes

Thanks
vsi

Posted: Sun Apr 02, 2006 8:08 pm
by ray.wurlod
This will be quite a tricky exercise if DataStage really is on a UNIX server. Do you use samba or some similar protocol to make Windows folders visible to UNIX? Unless this is the case, I doubt that DataStage-on-UNIX is the correct tool for this task.

Posted: Sun Apr 02, 2006 9:36 pm
by rleishman
Apols to Ray if he covered it lower in his reply, but you can get Zip and Unzip for Unix. I have used them on both Tru64 and Linux, I'd be surprised if they're not available for (some) other platforms as well - google it.

Posted: Sun Apr 02, 2006 11:42 pm
by ray.wurlod
More concerned for now how to use a Wait For File activity on UNIX to await the appearance of a file in a Windows folder, which it appears is what vsi wants to do. :?

Posted: Mon Apr 03, 2006 4:24 pm
by rleishman
Mmmm, yes :oops: . I really should read through to the end of the OP's post. "client tools are on Windows" is a bit inconclusive, but I think you're right to bet that the OP wants to wait on a remote file.

Posted: Wed Apr 05, 2006 3:58 pm
by vsi
Yes,

DataStage Designer,Manager,Director,Admin are running on
Windows 2k Prof.

The flat files exist on Unix Server.
normally i access the files using Putty.

Plz know me,if you have anzy questions..

Thanks
vsi

Posted: Wed Apr 05, 2006 4:29 pm
by rleishman
By "flat files", so you mean the Zip Files? If the Zip files are on Unix, try to source a WinZip compatible version of Zip compatible for your flavour of Unix - use Google.

Posted: Wed Apr 05, 2006 4:32 pm
by ray.wurlod
I'm not aware that any of the putty command line utilities gives you a Wait For File capability. You could, I guess, script a ptcp command to attempt to copy the file, and only proceed if it succeeds, otherwise sleep for a while and try again, but it's not a pretty solution.

Posted: Wed Apr 05, 2006 6:07 pm
by vsi
can i do all these stuff with in a job and create a scheduler..
i can use waitforfile activity in the job,
i can unzip the file and i can archive the zip file.

but i need a right approach for these...

Posted: Wed Apr 05, 2006 11:50 pm
by ray.wurlod
HOW can you use a Wait For File activity?

That's been my point. Unless you can "see" the Windows folder where the zip file will arrive from your UNIX machine on which DataStage is running, you will wait in vain.

Posted: Thu Apr 06, 2006 12:50 am
by kumar_s
So rather than beliveing in Datastge, you may start writing your own logic using routine or any bat file to wait for file and extract the same.

Posted: Thu Apr 06, 2006 11:23 am
by vsi
ray.wurlod wrote:HOW can you use a Wait For File activity?

That's been my point. Unless you can "see" the Windows folder where the zip file will arrive from your UNIX machine on which DataStage is running, you will wait in vain.
Hi ray,

FYI,

from Datastage Designer,
in sequence, WaitForFile activity,
when i click "Browse for File",i am able to see all the folders
which are existing in UNIX system.

Posted: Thu Apr 06, 2006 4:24 pm
by ray.wurlod
...and the zip file will arrive in a UNIX directory?

Posted: Thu Apr 06, 2006 4:30 pm
by vsi
ray.wurlod wrote:...and the zip file will arrive in a UNIX directory?

yes,
somehow the zip file is in Unix Directory.

Posted: Thu Apr 06, 2006 4:44 pm
by ray.wurlod
In that case you CAN use a Wait For File activity. Then an Execute Command activity to run a UNIX-based unzip or - alternately - use the same command as a filter in a Sequential File stage.