com.ibm.dbb.build

Class CopyToPDS

  • java.lang.Object
    • com.ibm.dbb.build.CopyToPDS
  • All Implemented Interfaces:
    IExecute


    public class CopyToPDS
    extends java.lang.Object
    implements IExecute
    This command is used to copy HFS files to partitioned datasets (PDS). A single file or an entire directory can be copied to PDS.

    Usage:

     CopyToPDS copyCmd = new CopyToPDS();
     copyCmd.setFile(new File(SRC_DIR + "/epsnbrvl.cbl"));
     copyCmd.setDataset(HLQ + "COBOL");
     copyCmd.setMember("EPSNBRVL");
     copyCmd.copy();
     
    This class also supports chaining:
     new CopyToPDS().file(new File(SRC_DIR + "/epsnbrvl.cbl")).dataset(HLQ + "COBOL").member("EPSNBRVL").copy();
     
    • Constructor Summary

      Constructors 
      Constructor and Description
      CopyToPDS() 
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      CopyToPDS archive(java.lang.String archive)
      Set the absolute path to the archive
      CopyToPDS archivedFile(java.lang.String archivedFile)
      Set the archived file (e.g src/cobol/example.cbl)
      void copy()
      Executes the CopyToPDS command
      CopyToPDS copyMode(DBBConstants.CopyMode copyMode)
      Set the mode used by the copy.
      static java.lang.String createMemberName(java.lang.String filepath)
      Parse the member from the path of a file, for example: /u/user/test/cobol/myfile.cbl will generate a member name MYFILE
      CopyToPDS dataset(java.lang.String dataset)
      Set the target data set
      CopyToPDS dependencies(java.util.List<PhysicalDependency> dependencies)
      Set the dependencies of the source file
      CopyToPDS deployType(java.lang.String deployType)
      Specify the deploy type
      int execute()
      Executes the CopyToPDS command
      CopyToPDS file(java.io.File file)
      Set the file to copy to a data set
      java.lang.String getArchive()
      Retrieve the absolute path to the archive
      java.lang.String getArchivedFile()
      Retrieve the archived file (e.g src/cobol/example.cbl)
      DBBConstants.CopyMode getCopyMode()
      Return the mode used by the copy.
      java.lang.String getDataset()
      Retrieve the target data set
      java.util.List<PhysicalDependency> getDependencies()
      Get all physical dependencies of the source file
      java.lang.String getDeployType()
      Return the deploy type
      java.io.File getFile()
      Retrieve the file to copy to a data set
      java.lang.String getHFSEncoding()
      Retrieve the source HFS file encoding.
      java.lang.String getKey()
      Return the key (file)
      java.lang.String getMember()
      Retrieve the target member
      java.lang.String getPDSEncoding()
      Retrieve the target PDS member encoding.
      java.lang.String getVolser()
      Return the volume serial of the data set
      CopyToPDS hfsEncoding(java.lang.String encoding)
      Set the source HFS file encoding.
      boolean isOutput()
      Return true if the output defined.
      CopyToPDS key(java.lang.String key)
      Specify the key (file)
      CopyToPDS member(java.lang.String member)
      Set the target member
      CopyToPDS output(boolean output)
      Set whether the output has been specified
      CopyToPDS pdsEncoding(java.lang.String encoding)
      Set the target PDS member encoding.
      void setArchive(java.lang.String archive)
      Set the absolute path to the archive
      void setArchivedFile(java.lang.String archivedFile)
      Set the archived file (e.g src/cobol/example.cbl)
      void setCopyMode(DBBConstants.CopyMode copyMode)
      Set the mode used by the copy.
      void setDataset(java.lang.String dataset)
      Set the target data set
      void setDependencies(java.util.List<PhysicalDependency> dependencies)
      Set the dependencies of the source file
      void setDeployType(java.lang.String deployType)
      Specify the deploy type
      void setFile(java.io.File file)
      Set the file to copy to a data set
      void setHFSEncoding(java.lang.String encoding)
      Set the source HFS file encoding.
      void setKey(java.lang.String key)
      Specify the key (file)
      void setMember(java.lang.String member)
      Set the target member
      void setOutput(boolean output)
      Set whether the output has been specified
      void setPDSEncoding(java.lang.String encoding)
      Set the target PDS member encoding.
      void setVolser(java.lang.String volser)
      Specify the volume serial of the data set
      CopyToPDS volser(java.lang.String volser)
      Specify the volume serial of the data set
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CopyToPDS

        public CopyToPDS()
    • Method Detail

      • execute

        public int execute()
                    throws BuildException
        Executes the CopyToPDS command
        Specified by:
        execute in interface IExecute
        Returns:
        The integer RC from the z/OS executed program.
        Throws:
        BuildException - If an error occurred when copying file to PDS
      • copy

        public void copy()
                  throws java.io.IOException,
                         BuildException
        Executes the CopyToPDS command
        Throws:
        java.io.IOException - If an error occurred when copying file to PDS
        BuildException - If an error occurred when copying file to PDS
      • createMemberName

        public static java.lang.String createMemberName(java.lang.String filepath)
        Parse the member from the path of a file, for example: /u/user/test/cobol/myfile.cbl will generate a member name MYFILE
        Parameters:
        filepath - the path of a file on HFS
        Returns:
        the member name
      • setHFSEncoding

        public void setHFSEncoding(java.lang.String encoding)
        Set the source HFS file encoding. Optional, default is 'Cp1047' - EBCDIC
        Parameters:
        encoding - Source HFS file encoding.
      • setPDSEncoding

        public void setPDSEncoding(java.lang.String encoding)
        Set the target PDS member encoding. Optional, default is 'Cp1047' - EBCDIC
        Parameters:
        encoding - Target PDS member encoding.
      • getHFSEncoding

        public java.lang.String getHFSEncoding()
        Retrieve the source HFS file encoding. Optional, default is 'Cp1047' - EBCDIC
        Returns:
        The source HFS file encoding.
      • getPDSEncoding

        public java.lang.String getPDSEncoding()
        Retrieve the target PDS member encoding. Optional, default is 'Cp1047' - EBCDIC
        Returns:
        The target PDS member encoding.
      • getFile

        public java.io.File getFile()
        Retrieve the file to copy to a data set
        Returns:
        the file to copy
      • setFile

        public void setFile(java.io.File file)
        Set the file to copy to a data set
        Parameters:
        file - the file to copy
      • getArchive

        public java.lang.String getArchive()
        Retrieve the absolute path to the archive
        Returns:
        the absolute path to the archive
      • setArchive

        public void setArchive(java.lang.String archive)
        Set the absolute path to the archive
        Parameters:
        archive - the absolute path to the archive
      • archive

        public CopyToPDS archive(java.lang.String archive)
        Set the absolute path to the archive
        Parameters:
        archive - the absolute path to the archive
        Returns:
        this instance
      • getArchivedFile

        public java.lang.String getArchivedFile()
        Retrieve the archived file (e.g src/cobol/example.cbl)
        Returns:
        the archived file
      • setArchivedFile

        public void setArchivedFile(java.lang.String archivedFile)
                             throws BuildException
        Set the archived file (e.g src/cobol/example.cbl)
        Parameters:
        archivedFile - the archived file
        Throws:
        BuildException - If an error occurred when copying file to PDS
      • archivedFile

        public CopyToPDS archivedFile(java.lang.String archivedFile)
                               throws BuildException
        Set the archived file (e.g src/cobol/example.cbl)
        Parameters:
        archivedFile - the archived file
        Returns:
        this instance
        Throws:
        BuildException - If an error occurred when copying file to PDS
      • getDependencies

        public java.util.List<PhysicalDependency> getDependencies()
        Get all physical dependencies of the source file
        Returns:
        the list of dependencies
      • setDependencies

        public void setDependencies(java.util.List<PhysicalDependency> dependencies)
        Set the dependencies of the source file
        Parameters:
        dependencies - the dependencies
      • getDataset

        public java.lang.String getDataset()
        Retrieve the target data set
        Returns:
        the data set
      • setDataset

        public void setDataset(java.lang.String dataset)
        Set the target data set
        Parameters:
        dataset - the data set
      • getMember

        public java.lang.String getMember()
        Retrieve the target member
        Returns:
        the member
      • setMember

        public void setMember(java.lang.String member)
        Set the target member
        Parameters:
        member - the member
      • file

        public CopyToPDS file(java.io.File file)
        Set the file to copy to a data set
        Parameters:
        file - the file to copy
        Returns:
        this instance
      • dependencies

        public CopyToPDS dependencies(java.util.List<PhysicalDependency> dependencies)
        Set the dependencies of the source file
        Parameters:
        dependencies - the dependencies
        Returns:
        this instance
      • dataset

        public CopyToPDS dataset(java.lang.String dataset)
        Set the target data set
        Parameters:
        dataset - the data set
        Returns:
        this instance
      • member

        public CopyToPDS member(java.lang.String member)
        Set the target member
        Parameters:
        member - the member
        Returns:
        this instance
      • hfsEncoding

        public CopyToPDS hfsEncoding(java.lang.String encoding)
        Set the source HFS file encoding. Optional, default is 'Cp1047' - EBCDIC
        Parameters:
        encoding - Source HFS file encoding.
        Returns:
        this instance
      • pdsEncoding

        public CopyToPDS pdsEncoding(java.lang.String encoding)
        Set the target PDS member encoding. Optional, default is 'Cp1047' - EBCDIC
        Parameters:
        encoding - Target PDS member encoding.
        Returns:
        this instance
      • getCopyMode

        public DBBConstants.CopyMode getCopyMode()
        Return the mode used by the copy. Possible values are: TEXT, BINARY, LOAD. Default value is TEXT.
        Returns:
        the mode used by the copying process
      • setCopyMode

        public void setCopyMode(DBBConstants.CopyMode copyMode)
        Set the mode used by the copy. Possible values are: TEXT, BINARY, LOAD. If mode is set to BINARY or LOAD, then hfsEncoding and pdsEncoding are ignored.
        Parameters:
        copyMode - set the mode used by the copy
      • copyMode

        public CopyToPDS copyMode(DBBConstants.CopyMode copyMode)
        Set the mode used by the copy. Possible values are: TEXT, BINARY, LOAD. If mode is set to BINARY or LOAD, then hfsEncoding and pdsEncoding are ignored.
        Parameters:
        copyMode - set the mode used by the copy
        Returns:
        this instance
      • getVolser

        public java.lang.String getVolser()
        Return the volume serial of the data set
        Returns:
        the volume serial of the data set
        Since:
        1.0.3
      • setVolser

        public void setVolser(java.lang.String volser)
        Specify the volume serial of the data set
        Parameters:
        volser - the volume serial of the data set
        Since:
        1.0.3
      • volser

        public CopyToPDS volser(java.lang.String volser)
        Specify the volume serial of the data set
        Parameters:
        volser - the volume serial of the data set
        Returns:
        the current instance of com.ibm.dbb.build.CopyToPDS
        Since:
        1.0.3
      • getDeployType

        public java.lang.String getDeployType()
        Return the deploy type
        Returns:
        the deploy type
      • setDeployType

        public void setDeployType(java.lang.String deployType)
        Specify the deploy type
        Parameters:
        deployType - the deploy type
      • deployType

        public CopyToPDS deployType(java.lang.String deployType)
        Specify the deploy type
        Parameters:
        deployType - the deploy type
        Returns:
        the current instance of com.ibm.dbb.build.CopyToPDS
      • getKey

        public java.lang.String getKey()
        Return the key (file)
        Returns:
        the key (file)
      • setKey

        public void setKey(java.lang.String key)
        Specify the key (file)
        Parameters:
        key - key file
      • key

        public CopyToPDS key(java.lang.String key)
        Specify the key (file)
        Parameters:
        key - key file
        Returns:
        the current instance of com.ibm.dbb.build.CopyToPDS
      • isOutput

        public boolean isOutput()
        Return true if the output defined. Default value is false
        Returns:
        true if the output defined.
      • setOutput

        public void setOutput(boolean output)
        Set whether the output has been specified
        Parameters:
        output - true or false
      • output

        public CopyToPDS output(boolean output)
        Set whether the output has been specified
        Parameters:
        output - true or false
        Returns:
        the current instance of com.ibm.dbb.build.CopyToPDS

<IBM Copyright © 2018 IBM Corp. All Rights Reserved.