Page 1 of 1

Capability to read a compressed file

Posted: Thu Apr 05, 2007 2:50 pm
by vnspn
Hi,

Does DataStage have the capability to read a compressed file?

If I received a file that is compressed from another application or a Mainframe system, can DataStage read that file?

Thanks.

Posted: Thu Apr 05, 2007 2:58 pm
by chulett
No. At least not directly. You'll need to 'uncompress' it first and that's a job for your O/S. Or your file transfer mechanism.

Posted: Thu Apr 05, 2007 7:26 pm
by ray.wurlod
You can specify unzip, gunzip, etc., as the filter command in a Sequential File stage. Then DataStage reads from the output of the command via a pipe.

Posted: Thu Apr 05, 2007 9:50 pm
by chulett
Which would be the 'O/S' that I mentioned. :wink:

And it will take more than a simple 'unzip' command in the Filter. That might get you the file names being unzipped but not their content. Make sure your unzipper / decompressor has an option to write the uncompressed output to standard out. For example:

Code: Select all

gunzip -c filename
Not sure what the equivalent would be on the Windows command line.

Posted: Thu Apr 05, 2007 10:17 pm
by ray.wurlod

Code: Select all

UnZip 5.50 of 17 February 2002, by Info-ZIP.  Maintained by C. Spieler.  Send
bug reports to the authors at Zip-Bugs@lists.wku.edu; see README for details.

Usage: unzip [-Z] [-opts[modifiers]] file[.zip] [list] [-x xlist] [-d exdir]
  Default action is to extract files in list, except those in xlist, to exdir;
  file[.zip] may be a wildcard.  -Z => ZipInfo mode ("unzip -Z" for usage).

  -p  extract files to pipe, no messages     -l  list files (short format)
  -f  freshen existing files, create none    -t  test compressed archive data
  -u  update files, create if necessary      -z  display archive comment
  -x  exclude files that follow (in xlist)   -d  extract files into exdir

modifiers:                                   -q  quiet mode (-qq => quieter)
  -n  never overwrite existing files         -a  auto-convert any text files
  -o  overwrite files WITHOUT prompting      -aa treat ALL files as text
  -j  junk paths (do not make directories)   -v  be verbose/print version info
  -C  match filenames case-insensitively     -L  make (some) names lowercase
  -$  label removables (-$$ => fixed disks)  -V  retain VMS version numbers
  -M  pipe through "more" pager              -s  spaces in filenames => '_'

Examples (see unzip.txt for more info):
  unzip data1 -x joe   => extract all files except joe from zipfile data1.zip
  unzip -fo foo ReadMe => quietly replace existing ReadMe if archive file newer

Posted: Thu Apr 05, 2007 10:26 pm
by chulett
Excellent. And freeware to boot. :wink:

http://www.info-zip.org/

I'm sure there's an equivalent for the command line package for WinZip which I have, didn't bother to check the syntax. Only caveat there is you need to have the registered version of WinZip, not still be freeloading off the 'evaluation' copy. :lol: