Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

unzip adapter help

Status
Not open for further replies.

clk430

Programmer
Sep 21, 2005
235
US
I have 6.7 and the documentaion doesn't say anything about unzipping files using the adaptor. We currently use a batch file that calles wzunzip.exe to unzip our files....but we get a lot of "source not available" errors, however files do get processed. I suspect wzunzip does not 'release' the files when unzipping quickly enough, so we get a double trigger issue.

Anyway, for the outpud card, what are the command lines for a *.zip file?
 
You need to execute a runmap,

Run ("UnzipMapName", " -iazip1 '" + path\file.zip +"," file_to_unzip +
"' -of1 '" + file_to_unzip + "'"))

or somthing like this

Run ("UnzipMapName", " -iazip1 c:\path\claimfile.zip, claimfile.837 -of1 claimfile.837"))

You UnzipMapName runmap requires 1 input and 1 output card. They can be text blobs. And, you must know the name of the file to be unzipped. It will not work like winzip and unzip all files known or unknown.

Finally, you cannot unzip password protected file with this method.

Look in the example folder structure too. Theres a sample map there.

For certain files we use a batch unzip here..... The map has 2 output cards.

First card looks like

put("file", "unzip_file.bat",
seriestotext("wzunzip path\file_name.zip"))

Second card looks like:

VALID(GET("BAT","-CMD .\unzip_file.bat -TRACE -AUDIT"),
FAIL("unzip_file.bat failed: " + LASTERRORMSG()))

Of course you can use this method if you have passwords or don't know what the compressed fiule names are.

 
Thanks eyetry, I'll give it a shot tomorrow. Will the first example work with a wildcard file name? For instance, *.tif?

Also, regarding your second example, will sinking the call force the files to be written to a temp extenstion first, then renamed like Datastage internally does for it's output files? I'm curious because winzip is too slow unzipping, thus our double trigger issue. However, if calling it from a map rule, I wonder if that will change....
 
I don't think you can use wildcards. I didn't spend a lot of time setting this up but my understanding is that you need to know exactly what it is you want to unzip.

Internally we have used 2 methods of zipping files for future use. One is not assigning a file extension to the decompressed file. So, 'group_name_file_date' would zip to 'group_name_file_date.zip'. This is usually used for archiving. The other is naming the zipped file with the decompressed file, file extension 'group_name_file_date.txt' becomes 'group_name_file_date.txt.zip'.

Second: play with it on your desktop. But you 'run' map command is overriding your unzip map output card settings. At that time the sink setting is irrelevant. From my experience though, with a normal map, the map writes to a temp file, which it renames when the job is complete. Don’t see that this should be any different.

PS: Seems like, a year or two ago, janhes had a solution for finding out what files were contained in a file before unzipping it but that might have been on a diff board. I could be wrong though.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top