Class ZipDatasets

java.lang.Object
com.ibm.jzos.sample.ZipDatasets

public class ZipDatasets extends Object
A sample Java main class that can be invoked to create a Zip archive from one or more datasets or PDS members. Datasets are treated as text and converted from EBCDIC to ASCII (ISO8859-1) or to the specified target codepage.

Details on the input arguments to this class are available by executing the main method with no arguments. (see usage())

Example: Zip several partitioned datasets to a Unix zip file:

com.ibm.jzos.sample.ZipDatasets test.zip sys1.proclib(asm*) hlq.**.jcl 

Example: Zip all datasets matching two patterns to a dataset:

com.ibm.jzos.sample.ZipDatasets //hlq.backup.zip payroll.*.data gl.**.dat*

Example: Zip data using DDs and input and output:

com.ibm.jzos.sample.ZipDatasets //DD:ZIPOUT //DD:INSEQ1 //DD:INPDS1 //DD:INPDS2(FOO*)

Since:
2.3.0
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    ZipDatasets(String outFileName, String[] indsnames)
    Construct an instance
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    main(String[] args)
    A Java main method for invoking this class.
    int
    run()
    Process the given input datasets and create a Zip archive on the given output file or dataset.
    void
    setTargetEncoding(String targetEncoding)
    Sets the name of the codepage used to encode the text data written to the Zip file.
    static void
    Display usage syntax for invoking this class as a java main() method.

    Methods inherited from class Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • ZipDatasets

      public ZipDatasets(String outFileName, String[] indsnames)
      Construct an instance
      Parameters:
      outFileName - the name of the /output/file, //DATASET, //DD:name, etc where the Zip archive is written.
      indsnames - an array of input dataset names / patterns
      See Also:
  • Method Details

    • usage

      public static void usage()
      Display usage syntax for invoking this class as a java main() method.
    • main

      public static void main(String[] args) throws Exception
      A Java main method for invoking this class.
      Parameters:
      args -
      Throws:
      Exception
      See Also:
    • setTargetEncoding

      public void setTargetEncoding(String targetEncoding)
      Sets the name of the codepage used to encode the text data written to the Zip file. If not called, defaults to DEFAULT_TARGET_ENCODING.
      Parameters:
      targetEncoding -
    • run

      public int run() throws IOException
      Process the given input datasets and create a Zip archive on the given output file or dataset.
      Throws:
      IOException