com.ibm.ftt.jes.util.core
Class JesJobUtil

java.lang.Object
  extended by com.ibm.ftt.jes.util.core.JesJobUtil
All Implemented Interfaces:
IJESJobUtil, IJESJobUtilExtension

public class JesJobUtil
extends Object
implements IJESJobUtilExtension

Utility class for submitting jobs to JES.


Field Summary
static String COPY_RIGHT
           
 
Constructor Summary
JesJobUtil(IOSImage systemImage)
          Creates a JesJobUtil instance for the specified system.
 
Method Summary
 InputStream getContents(String jobId)
          Return the contents of the spool data sets associated with the specified job.
 InputStream getContents(String jobId, String stepnameDdname)
          Return the contents of the spool data set associated with the specified stepname/ddname and job.
 String getContentString(String jobId)
          The same as IJESJobUtilExtension.getContents(String) except returns a String.
 String getContentString(String jobId, String ddName)
          The same as IJESJobUtilExtension.getContents(String, String) except returns a String.
 InputStream getJobContents(String jobId)
          Return the contents of the spool data sets associated with the specified job.
 InputStream getJobContents(String jobId, String ddName)
          Return the contents of the spool data set associated with the specified stepname/ddname and job.
 List<String> getJobDDNames(String jobId)
          Return a list containing the stepnames/ddnames identifying the spool data sets associated with a specific JES job.
 String getJobReturnCode(String jobId)
          Get the return code for the job identified by jobId.
 boolean hasJobFinishedExecuting(String jobId)
          Determines whether the job with the specified job id has finished execution.
 boolean isConnected()
          Determines whether the system associated with this IJESJobUtil instance is connected.
 String submit(Object resource)
          Submits the specified resource to the system associated with this IJESJobUtil instance.
 

Field Detail

COPY_RIGHT

public static final String COPY_RIGHT
See Also:
Constant Field Values
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 this IJESJobUtil instance is connected.

Specified by:
isConnected in interface IJESJobUtil
Returns:
true if connected, false otherwise

hasJobFinishedExecuting

public boolean hasJobFinishedExecuting(String jobId)
Description copied from interface: IJESJobUtil
Determines whether the job with the specified job id has finished execution.

Specified by:
hasJobFinishedExecuting in interface IJESJobUtil
Parameters:
jobId - the job id to check
Returns:
true if the job has finished, false if still running

submit

public String submit(Object resource)
              throws Exception
Description copied from interface: IJESJobUtil
Submits the specified resource to the system associated with this IJESJobUtil instance. The contents of the resource should be JCL.

Specified by:
submit in interface IJESJobUtil
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:
Exception - if job submit fails

getJobContents

public InputStream getJobContents(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 interface IJESJobUtil
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 InputStream getJobContents(String jobId,
                                  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 interface IJESJobUtil
Parameters:
jobId - the job id which identifies the JES job whose contents are to be returned
ddName - 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 List<String> getJobDDNames(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 interface IJESJobUtil
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

getJobReturnCode

public String getJobReturnCode(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 interface IJESJobUtil
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

getContentString

public String getContentString(String jobId)
                        throws OperationFailedException
Description copied from interface: IJESJobUtilExtension
The same as IJESJobUtilExtension.getContents(String) except returns a String.

Specified by:
getContentString in interface IJESJobUtilExtension
Returns:
the content, or null if contents are not available
Throws:
OperationFailedException

getContentString

public String getContentString(String jobId,
                               String ddName)
                        throws OperationFailedException
Description copied from interface: IJESJobUtilExtension
The same as IJESJobUtilExtension.getContents(String, String) except returns a String.

Specified by:
getContentString in interface IJESJobUtilExtension
Returns:
the content, or null if contents are not available
Throws:
OperationFailedException

getContents

public InputStream getContents(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 interface IJESJobUtilExtension
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 InputStream getContents(String jobId,
                               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 interface IJESJobUtilExtension
Parameters:
jobId - the job id which identifies the JES job whose contents are to be returned
stepnameDdname - 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