Package zosjobs

Class GetJobs


  • public class GetJobs
    extends Object
    Class to handle obtaining of z/OS batch job information
    Version:
    1.0
    Author:
    Frank Giordano
    • Constructor Detail

      • GetJobs

        public GetJobs​(ZOSConnection connection)
        Get jobs Constructor.
        Parameters:
        connection - ZOSConnection object
    • Method Detail

      • getJobs

        public List<Job> getJobs()
                          throws Exception
        Get jobs (defaults to the user ID of the session as owner).
        Returns:
        A list of job objects (matching jobs)
        Throws:
        Exception - error on getting a list of jobs
      • getJobsByPrefix

        public List<Job> getJobsByPrefix​(String prefix)
                                  throws Exception
        Get jobs that match a job name by prefix. Defaults to jobs owned by the user ID in the session.
        Parameters:
        prefix - Job name prefix for which to list jobs. Supports wildcard e.g. JOBNM*
        Returns:
        A list of job objects (matching jobs)
        Throws:
        Exception - error on getting a list of jobs
      • getJobsByOwner

        public List<Job> getJobsByOwner​(String owner)
                                 throws Exception
        Get jobs that are owned by a certain user or pattern of users.
        Parameters:
        owner - Owner for which to get jobs. Supports wildcard e.g. IBMU* returns jobs owned by all users whose ID beings with "IBMU"
        Returns:
        A list of job objects (matching jobs)
        Throws:
        Exception - error on getting a list of jobs
      • getJobsByOwnerAndPrefix

        public List<Job> getJobsByOwnerAndPrefix​(String owner,
                                                 String prefix)
                                          throws Exception
        Get a list of jobs that match an owner and prefix.
        Parameters:
        owner - Owner for which to get jobs. Supports wildcard e.g. IBMU* returns jobs owned by all users whose ID beings with "IBMU"
        prefix - Prefix for which to get jobs. Supports wildcard e.g. JOBNM* returns jobs with names starting with "JOBNM"
        Returns:
        A list of job objects (matching jobs)
        Throws:
        Exception - error on getting a list of jobs
      • getJob

        public Job getJob​(String jobId)
                   throws Exception
        Get a single job object from an input job id.
        Parameters:
        jobId - The job ID for the job for which you want to get status
        Returns:
        A list of job objects (matching jobs)
        Throws:
        Exception - error on getting job
      • getJobsCommon

        public List<Job> getJobsCommon​(GetJobParms parms)
                                throws Exception
        Get jobs filtered by owner and prefix.
        Parameters:
        parms - GetJobParms object
        Returns:
        A list of job objects (matching jobs)
        Throws:
        Exception - error on getting a list of jobs
      • getStatus

        public Job getStatus​(String jobName,
                             String jobId)
                      throws Exception
        Get the status and other details (e.g. owner, return code) for a job.
        Parameters:
        jobName - The job name for the job for which you want to get status
        jobId - The job ID for the job for which you want to get status
        Returns:
        A Job object (matching job)
        Throws:
        Exception - error on getting job
      • getStatusForJob

        public Job getStatusForJob​(Job job)
                            throws Exception
        Get the status and other details (e.g. owner, return code) for a job Alternate version of the API that accepts an Job object returned by other APIs such as SubmitJobs. Even though the parameter and return value are of the same type, the Job object returned will have the current status of the job.
        Parameters:
        job - Job object
        Returns:
        A Job object (matching job)
        Throws:
        Exception - error on getting job
      • getStatusCommon

        public Job getStatusCommon​(CommonJobParms parms)
                            throws Exception
        Get the status and other details (e.g. owner, return code) for a job.
        Parameters:
        parms - CommonJobParms object
        Returns:
        A Job object (matching job)
        Throws:
        Exception - error on getting job
      • getSpoolFiles

        public List<JobFile> getSpoolFiles​(String jobName,
                                           String jobId)
                                    throws Exception
        Get a list of all spool files for a job.
        Parameters:
        jobName - The job name for the job for which you want to get a list of spool files
        jobId - The job ID for the job for which you want to get a list of spool files
        Returns:
        A list of JobFile objects
        Throws:
        Exception - error on getting spool files info
      • getSpoolFilesForJob

        public List<JobFile> getSpoolFilesForJob​(Job job)
                                          throws Exception
        Get a list of all job spool files for a job. Alternate version of the API that accepts an Job object returned by other APIs such as SubmitJobs.
        Parameters:
        job - The job for which you would like to get a list of job spool files
        Returns:
        A list of JobFile objects
        Throws:
        Exception - error on getting spool files info
      • getSpoolFilesCommon

        public List<JobFile> getSpoolFilesCommon​(CommonJobParms parms)
                                          throws Exception
        Get a list of all job spool files for a job.
        Parameters:
        parms - CommonJobParms object
        Returns:
        A list of JobFile objects
        Throws:
        Exception - error on getting spool files info
      • getJcl

        public String getJcl​(String jobName,
                             String jobId)
                      throws Exception
        Get JCL from a job.
        Parameters:
        jobName - The job name for the job for which you want to retrieve JCL
        jobId - The job ID for the job for which you want to retrieve JCL
        Returns:
        A string representing job document on resolve
        Throws:
        Exception - error on getting jcl content
      • getJclForJob

        public String getJclForJob​(Job job)
                            throws Exception
        Get JCL from a job. Alternate version of the API that accepts an Job object returned by other APIs such as SubmitJobs.
        Parameters:
        job - The job for which you would like to retrieve JCL
        Returns:
        A string representing the JCL content
        Throws:
        Exception - error on getting jcl content
      • getJclCommon

        public String getJclCommon​(CommonJobParms parms)
                            throws Exception
        Get the JCL that was used to submit a job.
        Parameters:
        parms - CommonJobParms object
        Returns:
        A string representing the JCL content
        Throws:
        Exception - error on getting jcl content
      • getSpoolContent

        public String getSpoolContent​(JobFile jobFile)
                               throws Exception
        Get spool content from a job (keeping naming convention patter with this duplication function).
        Parameters:
        jobFile - The spool file for which you want to retrieve the content
        Returns:
        A string representing the spool content
        Throws:
        Exception - error on getting spool content
      • getSpoolContentById

        public String getSpoolContentById​(String jobName,
                                          String jobId,
                                          int spoolId)
                                   throws Exception
        Get spool content from a job using the job name, job ID, and spool ID number from z/OSMF.
        Parameters:
        jobName - The job name for the job containing the spool content
        jobId - The job id for the job containing the spool content
        spoolId - The Id number assigned by zosmf that identifies the particular job spool file (DD)
        Returns:
        A string representing the spool content
        Throws:
        Exception - error on getting spool content
      • getSpoolContentCommon

        public String getSpoolContentCommon​(JobFile jobFile)
                                     throws Exception
        Get spool content from a job.
        Parameters:
        jobFile - The spool file for which you want to retrieve the content
        Returns:
        A string representing the spool content
        Throws:
        Exception - error on getting spool content
      • getUrl

        public String getUrl()
        Get url specified for rest processing.
        Returns:
        A string representing a url