Class JesJobUtil
- java.lang.Object
-
- com.ibm.ftt.jes.util.core.JesJobUtil
-
- All Implemented Interfaces:
- IJESJobUtil, IJESJobUtilExtension
public class JesJobUtil extends java.lang.Object implements IJESJobUtilExtension
Utility class for submitting jobs to JES.
-
-
Field Summary
Fields Modifier and Type Field and Description static java.lang.String
COPY_RIGHT
boolean
defaultLogging
-
Constructor Summary
Constructors Constructor and Description JesJobUtil(IOSImage systemImage)
Creates a JesJobUtil instance for the specified system.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description boolean
didJobExecutionComplete(java.lang.String jobId)
Determines whether the job with the specified job id has completed execution.boolean
ensureJobExistence(java.lang.String jobId)
java.io.InputStream
getContents(java.lang.String jobId)
Return the contents of the spool data sets associated with the specified job.java.io.InputStream
getContents(java.lang.String jobId, java.lang.String stepnameDdname)
Return the contents of the spool data set associated with the specified stepname/ddname and job.java.lang.String
getContentString(java.lang.String jobId)
The same asIJESJobUtilExtension.getContents(String)
except returns a String.java.lang.String
getContentString(java.lang.String jobId, java.lang.String ddName)
The same asIJESJobUtilExtension.getContents(String, String)
except returns a String.JESJob
getJESJob(java.lang.String jobId)
Find a JESJob object given it's job id.java.io.InputStream
getJobContents(java.lang.String jobId)
Return the contents of the spool data sets associated with the specified job.java.io.InputStream
getJobContents(java.lang.String jobId, java.lang.String ddName)
Return the contents of the spool data set associated with the specified stepname/ddname and job.java.util.List<java.lang.String>
getJobDDNames(java.lang.String jobId)
Return a list containing the stepnames/ddnames identifying the spool data sets associated with a specific JES job.java.lang.String
getJobReturnCode(java.lang.String jobId)
Get the return code for the job identified by jobId.java.lang.String
getJobReturnInfo(java.lang.String jobId)
boolean
hasJobFinishedExecuting(java.lang.String jobId)
Determines whether the job with the specified job id has finished execution.boolean
isConnected()
Determines whether the system associated with thisIJESJobUtil
instance is connected.java.lang.String
purge(java.lang.String jobID)
java.lang.String
submit(java.lang.Object resource)
Submits the specified resource to the system associated with thisIJESJobUtil
instance.
-
-
-
Field Detail
-
COPY_RIGHT
public static final java.lang.String COPY_RIGHT
- See Also:
- Constant Field Values
-
defaultLogging
public boolean defaultLogging
-
-
Constructor Detail
-
JesJobUtil
public JesJobUtil(IOSImage systemImage)
Creates a JesJobUtil instance for the specified system.- Parameters:
systemImage
- system associated with this utility instance
-
-
Method Detail
-
isConnected
public boolean isConnected()
Description copied from interface:IJESJobUtil
Determines whether the system associated with thisIJESJobUtil
instance is connected.- Specified by:
isConnected
in interfaceIJESJobUtil
- Returns:
true
if connected,false
otherwise
-
hasJobFinishedExecuting
public boolean hasJobFinishedExecuting(java.lang.String jobId)
Description copied from interface:IJESJobUtil
Determines whether the job with the specified job id has finished execution.- Specified by:
hasJobFinishedExecuting
in interfaceIJESJobUtil
- Parameters:
jobId
- the job id to check- Returns:
true
if the job has finished,false
if still running
-
ensureJobExistence
public boolean ensureJobExistence(java.lang.String jobId)
-
submit
public java.lang.String submit(java.lang.Object resource) throws java.lang.Exception
Description copied from interface:IJESJobUtil
Submits the specified resource to the system associated with thisIJESJobUtil
instance. The contents of the resource should be JCL.- Specified by:
submit
in interfaceIJESJobUtil
- Parameters:
resource
- the resource object to be submitted; the resource can be a data set member or a workstation file- Returns:
- the job id as a result of the submit operation, or
null
if the job id returned by the server is not valid - Throws:
java.lang.Exception
- if job submit fails
-
getJobContents
public java.io.InputStream getJobContents(java.lang.String jobId) throws OperationFailedException
Description copied from interface:IJESJobUtil
Return the contents of the spool data sets associated with the specified job. The job is identified by the job id which is returned by submit().- Specified by:
getJobContents
in interfaceIJESJobUtil
- Parameters:
jobId
- the job id whose contents are to be returned- Returns:
- the contents of the JES job spool data sets, or null if job contents are not available. Contents are encoded as UTF-8 bytes.
- Throws:
OperationFailedException
- if the job associated with job id cannot be found or if the job has not finished executing
-
getJobContents
public java.io.InputStream getJobContents(java.lang.String jobId, java.lang.String ddName) throws OperationFailedException
Description copied from interface:IJESJobUtil
Return the contents of the spool data set associated with the specified stepname/ddname and job.The job is identified by the job id which is returned by submit().
The stepname/ddname is of the form STEPNAME.DDNAME, or simply DDNAME if no stepname applies. This is the same form as returned by
IJESJobUtil.getJobDDNames(String)
.- Specified by:
getJobContents
in interfaceIJESJobUtil
- Parameters:
jobId
- the job id which identifies the JES job whose contents are to be returnedddName
- the stepname/ddname- Returns:
- the contents of the JES job spool data set, or null if job output is not available. Contents are encoded as UTF-8 bytes.
- Throws:
OperationFailedException
- if the job associated with jobId cannot be found or if the job has not finished executing
-
getJobDDNames
public java.util.List<java.lang.String> getJobDDNames(java.lang.String jobId) throws OperationFailedException
Description copied from interface:IJESJobUtil
Return a list containing the stepnames/ddnames identifying the spool data sets associated with a specific JES job.The job is identified by the job id which is returned by submit().
The stepnames/ddnames are of the form STEPNAME.DDNAME, or simply DDNAME if no stepname applies.
- Specified by:
getJobDDNames
in interfaceIJESJobUtil
- Parameters:
jobId
- the job id which identifies the JES job whose spool data set DDNames are to be returned- Returns:
- a list containing the DDNames of the spool data sets for the specified job
- Throws:
OperationFailedException
- if the job associated with jobId cannot be found or if the job has not finished executing
-
getJESJob
public JESJob getJESJob(java.lang.String jobId) throws OperationFailedException
Find a JESJob object given it's job id.- Parameters:
jobId
- - the job id of the job to be found and returned- Returns:
- the JES job with an id matching the input parameter or null if no such job can be found
- Throws:
OperationFailedException
-
getJobReturnCode
public java.lang.String getJobReturnCode(java.lang.String jobId) throws OperationFailedException
Description copied from interface:IJESJobUtil
Get the return code for the job identified by jobId. The most common conventional values are:U0000 = all OK U0004 = minor errors or problems U0008 = significant errors or problems U0012 = major errors or problems, the results (e.g. files or reports produced) should not be trusted. U0016 = very serious problems, do not use the results!
- Specified by:
getJobReturnCode
in interfaceIJESJobUtil
- Parameters:
jobId
- the Job Id whose return code is to be returned- Returns:
- the return code assigned to the job by the remote system or null if no return code has been assigned
- Throws:
OperationFailedException
- if the job associated with jobId cannot be found or if the job has not finished executing
-
getJobReturnInfo
public java.lang.String getJobReturnInfo(java.lang.String jobId) throws OperationFailedException
- Throws:
OperationFailedException
-
getContentString
public java.lang.String getContentString(java.lang.String jobId) throws OperationFailedException
Description copied from interface:IJESJobUtilExtension
The same asIJESJobUtilExtension.getContents(String)
except returns a String.- Specified by:
getContentString
in interfaceIJESJobUtilExtension
- Returns:
- the content, or null if contents are not available
- Throws:
OperationFailedException
-
getContentString
public java.lang.String getContentString(java.lang.String jobId, java.lang.String ddName) throws OperationFailedException
Description copied from interface:IJESJobUtilExtension
The same asIJESJobUtilExtension.getContents(String, String)
except returns a String.- Specified by:
getContentString
in interfaceIJESJobUtilExtension
- Returns:
- the content, or null if contents are not available
- Throws:
OperationFailedException
-
getContents
public java.io.InputStream getContents(java.lang.String jobId) throws OperationFailedException
Description copied from interface:IJESJobUtilExtension
Return the contents of the spool data sets associated with the specified job. The job is identified by the job id which is returned by submit().The same as
IJESJobUtil.getJobContents(String)
except contents are returned in the default workbench encoding.- Specified by:
getContents
in interfaceIJESJobUtilExtension
- Parameters:
jobId
- the job id whose contents are to be returned- Returns:
- the contents of the JES job spool data sets, or null if job contents are not available
- Throws:
OperationFailedException
- if the job associated with job id cannot be found or if the job has not finished executing
-
getContents
public java.io.InputStream getContents(java.lang.String jobId, java.lang.String stepnameDdname) throws OperationFailedException
Description copied from interface:IJESJobUtilExtension
Return the contents of the spool data set associated with the specified stepname/ddname and job.The job is identified by the job id which is returned by submit().
The stepname/ddname is of the form STEPNAME.DDNAME, or simply DDNAME if no stepname applies. This is the same form as returned by
IJESJobUtil.getJobDDNames(String)
.The same as
IJESJobUtil.getJobContents(String, String)
except contents are returned in the default workbench encoding.- Specified by:
getContents
in interfaceIJESJobUtilExtension
- Parameters:
jobId
- the job id which identifies the JES job whose contents are to be returnedstepnameDdname
- the stepname/ddname- Returns:
- the contents of the JES job spool data set, or null if job output is not available
- Throws:
OperationFailedException
- if the job associated with jobId cannot be found or if the job has not finished executing
-
didJobExecutionComplete
public boolean didJobExecutionComplete(java.lang.String jobId) throws JESJobNotFoundException
Description copied from interface:IJESJobUtil
Determines whether the job with the specified job id has completed execution.- Specified by:
didJobExecutionComplete
in interfaceIJESJobUtil
- Parameters:
jobId
- the job id to check- Returns:
true
if the job has finished,false
if still running- Throws:
JESJobNotFoundException
- if the job associated with job id cannot be found or if the job has already been purged
-
purge
public java.lang.String purge(java.lang.String jobID) throws java.lang.Exception
- Throws:
java.lang.Exception
-
-