Package com.ibm.dbb.build
Class JobExec
- java.lang.Object
-
- com.ibm.dbb.build.JobExec
-
- All Implemented Interfaces:
IExecute
public class JobExec extends java.lang.Object implements IExecute
Submit a JCL job from a member of a data set, a file on HFS, or a String. Serves as a replacement to JCLExec. Example of usage:def jobExec = new JobExec().dataset("USR1.JCL").member("TEST") def rc = jobExec.execute() def jobID = jobExec.getSubmittedJobId() def jobName = jobExec.getSubmittedJobName() def listDDNames = jobExec.getAllDDNames(true) jobExec.saveOutput(new File("/u/usr1/jcl/output.txt"))
- Since:
- 2.0.1
-
-
Constructor Summary
Constructors Constructor Description JobExec()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description JobExec
buildFile(java.lang.String buildFile)
Set the build file associated with this JobExec.JobExec
dataset(java.lang.String dataset)
Set the data set containing the JCL to be submittedint
execute()
Submit a JCL job and wait for the job to complete with default wait time of 1 hourint
execute(int timeout, java.util.concurrent.TimeUnit timeUnit)
Deprecated.As of release 2.0.2, set timeout withsetTimeout(int, java.util.concurrent.TimeUnit)
and useexecute()
.JobExec
file(java.io.File file)
Set the file on the HFS that contains the JCL to be submittedjava.util.List<java.lang.String>
getAllDDNames()
Return all output DD names of the submitted job (qualified: false)java.util.List<java.lang.String>
getAllDDNames(boolean qualified)
Return all qualified output DD names of the submitted job.java.lang.String
getBuildFile()
Return the build file associated with this JobExec.java.lang.String
getDataset()
Return the data set containing the JCL to be submittedjava.io.File
getFile()
Return the file on the HFS that contains the JCL to be submittedjava.lang.String
getJclEncoding()
Return the encoding of the JCL using standard charset namejava.lang.String
getMaxRC()
Deprecated.As of release 3.0, replaced byexecute()
java.lang.String
getMember()
Return the member in a data set that contains the JCL to be submittedjava.lang.String
getSubmittedJobId()
Returns the ID of the submitted jobjava.lang.String
getSubmittedJobIdAsRexx()
Returns the Name and ID of the submitted job in form of <jobName>(<jobId>)java.lang.String
getSubmittedJobName()
Returns the name of the submitted jobjava.lang.String
getText()
Return the JCL text to be submittedjava.lang.String
getVolser()
Return the volume serial of the data setJobExec
jclEncoding(java.lang.String jclEncoding)
Set the encoding of the JCL using standard charset nameJobExec
member(java.lang.String member)
Set the member in a data set that contains the JCL to be submittedvoid
saveOutput(java.io.File file)
Save the output of the submitted job in a file on HFSvoid
saveOutput(java.io.File file, java.lang.String targetEncoding)
Save the output of the submitted job in a file on HFSvoid
saveOutput(java.lang.String ddName, java.io.File file)
Save the output of a specific DD in a file on HFSvoid
saveOutput(java.lang.String ddName, java.io.File file, java.lang.String targetEncoding)
Save the output of a specific DD in a file on HFSvoid
saveOutput(java.lang.String ddName, java.io.File file, java.lang.String sourceEncoding, java.lang.String targetEncoding)
Save the output of a specific DD in a file on HFSvoid
setBuildFile(java.lang.String buildFile)
Set the build file associated with this JobExec.void
setDataset(java.lang.String dataset)
Set the data set containing the JCL to be submittedvoid
setFile(java.io.File file)
Set the file on the HFS that contains the JCL to be submittedvoid
setJclEncoding(java.lang.String jclEncoding)
Set the encoding of the JCL using standard charset namevoid
setMember(java.lang.String member)
Set the member in a data set that contains the JCL to be submittedvoid
setText(java.lang.String text)
Set the content of the JCL to be submittedvoid
setTimeout(int timeout, java.util.concurrent.TimeUnit timeUnit)
Set the timeout period to wait for job.void
setVolser(java.lang.String volser)
Specify the volume serial of the data setJobExec
text(java.lang.String text)
Set the content of the JCL to be submittedJobExec
timeout(int timeout, java.util.concurrent.TimeUnit timeUnit)
Set the timeout period to wait for job.JobExec
volser(java.lang.String volser)
Specify the volume serial of the data set
-
-
-
Method Detail
-
execute
public int execute() throws BuildException
Submit a JCL job and wait for the job to complete with default wait time of 1 hour- Specified by:
execute
in interfaceIExecute
- Returns:
- The maximum return code of the JCL Job
- Throws:
BuildException
- if an error occurred
-
execute
@Deprecated public int execute(int timeout, java.util.concurrent.TimeUnit timeUnit) throws BuildException
Deprecated.As of release 2.0.2, set timeout withsetTimeout(int, java.util.concurrent.TimeUnit)
and useexecute()
. Submit a JCL job and wait for the job to complete within a designated time- Parameters:
timeout
- the amount of time to waittimeUnit
- the unit of time- Returns:
- The maximum return code of the JCL Job
- Throws:
BuildException
- if an error occurred
-
getSubmittedJobIdAsRexx
public java.lang.String getSubmittedJobIdAsRexx()
Returns the Name and ID of the submitted job in form of <jobName>(<jobId>)- Returns:
- the ID of the submitted job
-
getSubmittedJobId
public java.lang.String getSubmittedJobId()
Returns the ID of the submitted job- Returns:
- the ID of the submitted job
-
getSubmittedJobName
public java.lang.String getSubmittedJobName()
Returns the name of the submitted job- Returns:
- the name of the submitted job
-
getAllDDNames
public java.util.List<java.lang.String> getAllDDNames()
Return all output DD names of the submitted job (qualified: false)- Returns:
- a list of output DD names of the submitted job
-
getAllDDNames
public java.util.List<java.lang.String> getAllDDNames(boolean qualified)
Return all qualified output DD names of the submitted job. DDNames are returned in the form of "<ddname>:<stepname>:<procstepname>" (ex. JESYSMSG:JES2:, SYSPRINT:LINKMSGT:, SYSTSPRT:DMHENU:GENMSG, SYSPRINT::). The names returned may be used insaveOutput
.- Parameters:
qualified
- retrieve qualified DD names if true- Returns:
- a list of output DD names of the submitted job conditionally qualified
-
saveOutput
public void saveOutput(java.io.File file) throws BuildException
Save the output of the submitted job in a file on HFS- Parameters:
file
- the target file to save the output to- Throws:
BuildException
- If DDName cannot be parsed or if codepages provided are invalid
-
saveOutput
public void saveOutput(java.io.File file, java.lang.String targetEncoding) throws BuildException
Save the output of the submitted job in a file on HFS- Parameters:
file
- the target file to save the output totargetEncoding
- the iconv encoding to be used to write the output- Throws:
BuildException
- If DDName cannot be parsed or if codepages provided are invalid
-
saveOutput
public void saveOutput(java.lang.String ddName, java.io.File file) throws BuildException
Save the output of a specific DD in a file on HFS- Parameters:
ddName
- the DD containing the output to be saved. Can be qualified in the form DD:STEP:PROC and use splat (*) to retrieve all (e.g. JESYSMSG:JES2:, SYSTSPRT:DMHENU:GENMSG, SYSPRINT::)file
- the target file to save the output to- Throws:
BuildException
- If DDName cannot be parsed or if codepages provided are invalid
-
saveOutput
public void saveOutput(java.lang.String ddName, java.io.File file, java.lang.String targetEncoding) throws BuildException
Save the output of a specific DD in a file on HFS- Parameters:
ddName
- the DD containing the output to be saved. Can be qualified in the form DD:STEP:PROC and use splat (*) to retrieve all (e.g. JESYSMSG:JES2:, SYSTSPRT:DMHENU:GENMSG, SYSPRINT::)file
- the target file to save the output totargetEncoding
- the iconv encoding to be used to write the output- Throws:
BuildException
- If DDName cannot be parsed or if codepages provided are invalid
-
saveOutput
public void saveOutput(java.lang.String ddName, java.io.File file, java.lang.String sourceEncoding, java.lang.String targetEncoding) throws BuildException
Save the output of a specific DD in a file on HFS- Parameters:
ddName
- the DD containing the output to be saved. Can be qualified in the form DD:STEP:PROC and use splat (*) to retrieve all (e.g. JESYSMSG:JES2:, SYSTSPRT:DMHENU:GENMSG, SYSPRINT::)file
- the target file to save the output tosourceEncoding
- the iconv encoding of the source outputtargetEncoding
- the iconv encoding to be used to write the output- Throws:
BuildException
- If DDName cannot be parsed or if codepages provided are invalid
-
getDataset
public java.lang.String getDataset()
Return the data set containing the JCL to be submitted- Returns:
- the data set containing the JCL to be submitted
-
setDataset
public void setDataset(java.lang.String dataset)
Set the data set containing the JCL to be submitted- Parameters:
dataset
- the data set containing the JCL to be submitted
-
dataset
public JobExec dataset(java.lang.String dataset)
Set the data set containing the JCL to be submitted- Parameters:
dataset
- the data set containing the JCL to be submitted- Returns:
- this instance of the JobExec
-
getMember
public java.lang.String getMember()
Return the member in a data set that contains the JCL to be submitted- Returns:
- the member in a data set that contains the JCL to be submitted
-
setMember
public void setMember(java.lang.String member)
Set the member in a data set that contains the JCL to be submitted- Parameters:
member
- the member in a data set that contains the JCL to be submitted
-
member
public JobExec member(java.lang.String member)
Set the member in a data set that contains the JCL to be submitted- Parameters:
member
- the member in a data set that contains the JCL to be submitted- Returns:
- this instance of the JobExec
-
getBuildFile
public java.lang.String getBuildFile()
Return the build file associated with this JobExec. Build file is used to set file in Build Report record. If Build file is not set, Build Report will use path ofgetFile()
instead.- Returns:
- the build file associated with this JobExec.
-
setBuildFile
public void setBuildFile(java.lang.String buildFile)
Set the build file associated with this JobExec. Build file is used to set file in Build Report record. If Build file is not set, Build Report will use path ofgetFile()
instead.- Parameters:
buildFile
- The build file to associate with this JobExec.
-
buildFile
public JobExec buildFile(java.lang.String buildFile)
Set the build file associated with this JobExec. Build file is used to set file in Build Report record. If Build file is not set, Build Report will use path ofgetFile()
instead.- Parameters:
buildFile
- The build file to associate with this JobExec.- Returns:
- This instance of JobExec
-
getFile
public java.io.File getFile()
Return the file on the HFS that contains the JCL to be submitted- Returns:
- the file on the HFS that contains the JCL to be submitted
-
setFile
public void setFile(java.io.File file)
Set the file on the HFS that contains the JCL to be submitted- Parameters:
file
- the file on the HFS that contains the JCL to be submitted
-
file
public JobExec file(java.io.File file)
Set the file on the HFS that contains the JCL to be submitted- Parameters:
file
- the file on the HFS that contains the JCL to be submitted- Returns:
- this instance of the JobExec
-
getText
public java.lang.String getText()
Return the JCL text to be submitted- Returns:
- the JCL text to be submitted
-
setText
public void setText(java.lang.String text)
Set the content of the JCL to be submitted- Parameters:
text
- the content of the JCL to be submitted
-
text
public JobExec text(java.lang.String text)
Set the content of the JCL to be submitted- Parameters:
text
- the content of the JCL to be submitted- Returns:
- this instance of the JobExec
-
getJclEncoding
public java.lang.String getJclEncoding()
Return the encoding of the JCL using standard charset name- Returns:
- the encoding of the JCL using standard charset name
-
setJclEncoding
public void setJclEncoding(java.lang.String jclEncoding)
Set the encoding of the JCL using standard charset name- Parameters:
jclEncoding
- the encoding of the JCL using standard charset name
-
jclEncoding
public JobExec jclEncoding(java.lang.String jclEncoding)
Set the encoding of the JCL using standard charset name- Parameters:
jclEncoding
- the encoding of the JCL using standard charset name- Returns:
- this instance of the JobExec
-
getMaxRC
@Deprecated public java.lang.String getMaxRC()
Deprecated.As of release 3.0, replaced byexecute()
- Returns:
- the Maximum Return Code of the submitted job
-
getVolser
public java.lang.String getVolser()
Return the volume serial of the data set- Returns:
- the volume serial of the data set
-
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
-
volser
public JobExec volser(java.lang.String volser)
Specify the volume serial of the data set- Parameters:
volser
- the volume serial of the data set- Returns:
- this instance of JobExec
-
setTimeout
public void setTimeout(int timeout, java.util.concurrent.TimeUnit timeUnit)
Set the timeout period to wait for job. Default is 1 hour- Parameters:
timeout
- The timeout lengthtimeUnit
- The time unit
-
timeout
public JobExec timeout(int timeout, java.util.concurrent.TimeUnit timeUnit)
Set the timeout period to wait for job. Default is 1 hour- Parameters:
timeout
- The timeout lengthtimeUnit
- The time unit- Returns:
- this instance of JobExec
-
-