Package 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 Description CopyToPDS()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CopyToPDSarchive(java.lang.String archive)Set the absolute path to the archiveCopyToPDSarchivedFile(java.lang.String archivedFile)Set the archived file (e.g src/cobol/example.cbl)voidcopy()Executes the CopyToPDS commandCopyToPDScopyMode(DBBConstants.CopyMode copyMode)Set the mode used by the copy.static java.lang.StringcreateMemberName(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 MYFILECopyToPDSdataset(java.lang.String dataset)Set the target data setCopyToPDSdependencies(java.util.List<PhysicalDependency> dependencies)Set the dependencies of the source fileCopyToPDSdeployType(java.lang.String deployType)Specify the deploy typeintexecute()Executes the CopyToPDS commandCopyToPDSfile(java.io.File file)Set the file to copy to a data setjava.lang.StringgetArchive()Retrieve the absolute path to the archivejava.lang.StringgetArchivedFile()Retrieve the archived file (e.g src/cobol/example.cbl)DBBConstants.CopyModegetCopyMode()Return the mode used by the copy.java.lang.StringgetDataset()Retrieve the target data setjava.util.List<PhysicalDependency>getDependencies()Get all physical dependencies of the source filejava.lang.StringgetDeployType()Return the deploy typejava.io.FilegetFile()Retrieve the file to copy to a data setjava.lang.StringgetHFSEncoding()Retrieve the source HFS file encoding.java.lang.StringgetKey()Return the key (file)java.lang.StringgetMember()Retrieve the target memberjava.lang.StringgetPDSEncoding()Retrieve the target PDS member encoding.java.lang.StringgetVolser()Return the volume serial of the data setCopyToPDShfsEncoding(java.lang.String encoding)Set the source HFS file encoding.booleanisOutput()Returntrueif the output defined.CopyToPDSkey(java.lang.String key)Specify the key (file)CopyToPDSmember(java.lang.String member)Set the target memberCopyToPDSoutput(boolean output)Set whether the output has been specifiedCopyToPDSpdsEncoding(java.lang.String encoding)Set the target PDS member encoding.voidsetArchive(java.lang.String archive)Set the absolute path to the archivevoidsetArchivedFile(java.lang.String archivedFile)Set the archived file (e.g src/cobol/example.cbl)voidsetCopyMode(DBBConstants.CopyMode copyMode)Set the mode used by the copy.voidsetDataset(java.lang.String dataset)Set the target data setvoidsetDependencies(java.util.List<PhysicalDependency> dependencies)Set the dependencies of the source filevoidsetDeployType(java.lang.String deployType)Specify the deploy typevoidsetFile(java.io.File file)Set the file to copy to a data setvoidsetHFSEncoding(java.lang.String encoding)Set the source HFS file encoding.voidsetKey(java.lang.String key)Specify the key (file)voidsetMember(java.lang.String member)Set the target membervoidsetOutput(boolean output)Set whether the output has been specifiedvoidsetPDSEncoding(java.lang.String encoding)Set the target PDS member encoding.voidsetVolser(java.lang.String volser)Specify the volume serial of the data setCopyToPDSvolser(java.lang.String volser)Specify the volume serial of the data set
-
-
-
Method Detail
-
execute
public int execute() throws BuildExceptionExecutes the CopyToPDS command- Specified by:
executein interfaceIExecute- 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, BuildExceptionExecutes the CopyToPDS command- Throws:
java.io.IOException- If an error occurred when copying file to PDSBuildException- 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 BuildExceptionSet 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 isTEXT.- 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 toBINARYorLOAD, 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 toBINARYorLOAD, 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()
Returntrueif the output defined. Default value isfalse- Returns:
trueif the output defined.
-
setOutput
public void setOutput(boolean output)
Set whether the output has been specified- Parameters:
output-trueorfalse
-
output
public CopyToPDS output(boolean output)
Set whether the output has been specified- Parameters:
output-trueorfalse- Returns:
- the current instance of
com.ibm.dbb.build.CopyToPDS
-
-