com.ibm.dbb.build

Class JCLExec

  • java.lang.Object
    • com.ibm.dbb.build.JCLExec
  • All Implemented Interfaces:
    IExecute, IExecute2


    public class JCLExec
    extends java.lang.Object
    implements IExecute2
    Submit a JCL in a member of a data set, or a file on HFS, or an internal memory. Example of usage:
     JCLExec exec = new JCLExec()
     exec.confDir('/var/dbb_1.0.1/conf')
     def rc = exec.dataset('USER.JCL').member('SAMPLE').execute()
     println "Job '${exec.getSubmittedJobId()}' was submitted successfully with maxRC = ${exec.maxRC}"
     exec.getAllDDNames().each({ ddName -> println "DD Name: $ddName"
         def file = new File("/u/user/sample/${ddName}.output")
         exec.saveOutput(ddName, file, null)    
     })
     
    • Constructor Summary

      Constructors 
      Constructor and Description
      JCLExec() 
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      JCLExec confDir(java.lang.String confDir)
      Set the configuration directory where jobOutput REXX script could be found
      JCLExec dataset(java.lang.String dataset)
      Set the data set contains the JCL to be submitted
      int execute()
      Submit a JCL and wait for the job has been submitted
      int executeAndWaitFor(int timeout, java.util.concurrent.TimeUnit unit)
      Submit a JCL and wait for a certain time before return
      JCLExec file(java.io.File file)
      Set the file on the HFS that contains the JCL to be submitted
      java.util.List<java.lang.String> getAllDDNames()
      Return all output DD names of the submitted job
      java.util.List<java.lang.String> getAllDDNames(boolean qualified)
      Return all qualified output DD names of the submitted job.
      java.lang.String getConfDir()
      Returns the configuration directory where jobOutput REXX script could be found
      java.lang.String getDataset()
      Return the data set that contains the JCL to be submitted
      java.io.File getFile()
      Return the file on the HFS that contains the JCL to be submitted
      java.lang.String getJclEncoding()
      Return the encoding of the JCL
      java.lang.String getMaxRC()
      Return the Max RC of the submitted job
      java.lang.String getMember()
      Return the member in a data set that contains the JCL to be submitted
      java.lang.String getSubmittedJobId()
      Returns the ID of the submitted job in form of <jobName>(<jobId>)
      java.lang.String getSubmittedJobName()
      Returns the name of the submitted job
      java.lang.String getText()
      Return the JCL to be submitted
      java.lang.String getVolser()
      Return the volume serial of the data set
      JCLExec jclEncoding(java.lang.String jclEncoding)
      Set the encoding of the JCL
      JCLExec member(java.lang.String member)
      Set the member in a data set that contains the JCL to be submitted
      void saveOutput(java.io.File file)
      Save the output of the submitted job in a file on HFS
      void saveOutput(java.io.File file, java.lang.String encoding)
      Save the output of the submitted job in a file on HFS
      void saveOutput(java.lang.String ddName, java.io.File file)
      Save the output of a specific DD in a file on HFS
      void saveOutput(java.lang.String ddName, java.io.File file, boolean removeASA)
      Save the output of a specific DD in a file on HFS
      void saveOutput(java.lang.String ddName, java.io.File file, java.lang.String encoding)
      Save the output of a specific DD in a file on HFS
      void saveOutput(java.lang.String ddName, java.io.File file, java.lang.String encoding, boolean removeASA)
      Save the output of a specific DD in a file on HFS
      void saveOutput(java.lang.String ddName, java.lang.String sourceEncoding, java.io.File file, java.lang.String targetEncoding, boolean removeASA)
      Save the output of a specific DD in a file on HFS
      void setConfDir(java.lang.String confDir)
      Set the configuration directory where jobOutput REXX script could be found
      void setDataset(java.lang.String dataset)
      Set the data set contains the JCL to be submitted
      void setFile(java.io.File file)
      Set the file on the HFS that contains the JCL to be submitted
      void setJclEncoding(java.lang.String jclEncoding)
      Set the encoding of the JCL
      void setMember(java.lang.String member)
      Set the member in a data set that contains the JCL to be submitted
      void setText(java.lang.String text)
      Set the content of the JCL to be submitted
      void setVolser(java.lang.String volser)
      Specify the volume serial of the data set
      JCLExec text(java.lang.String text)
      Set the content of the JCL to be submitted
      JCLExec volser(java.lang.String volser)
      Specify the volume serial of the data set
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • JCLExec

        public JCLExec()
    • Method Detail

      • executeAndWaitFor

        public int executeAndWaitFor(int timeout,
                                     java.util.concurrent.TimeUnit unit)
                              throws BuildException
        Submit a JCL and wait for a certain time before return
        Specified by:
        executeAndWaitFor in interface IExecute2
        Parameters:
        timeout - the amount of time to wait
        unit - the timeout unit
        Returns:
        0 if the job has been submitted successfully, or 1 if a timeout has been reached
        Throws:
        BuildException - if an error occurred
      • execute

        public int execute()
                    throws BuildException
        Submit a JCL and wait for the job has been submitted
        Specified by:
        execute in interface IExecute
        Returns:
        always 0 unless an exception occurred
        Throws:
        BuildException - if an error occurred
      • getSubmittedJobId

        public java.lang.String getSubmittedJobId()
        Returns the ID of the submitted job in form of <jobName>(<jobId>)
        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
      • getDataset

        public java.lang.String getDataset()
        Return the data set that contains the JCL to be submitted
        Returns:
        the data set that contains the JCL to be submitted
      • setDataset

        public void setDataset(java.lang.String dataset)
        Set the data set contains the JCL to be submitted
        Parameters:
        dataset - the data set contains the JCL to be submitted
      • dataset

        public JCLExec dataset(java.lang.String dataset)
        Set the data set contains the JCL to be submitted
        Parameters:
        dataset - the data set contains the JCL to be submitted
        Returns:
        this instance of the JCLExec
      • 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 JCLExec 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 JCLExec
      • 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 JCLExec 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 JCLExec
      • getText

        public java.lang.String getText()
        Return the JCL to be submitted
        Returns:
        the JCL 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 JCLExec 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 JCLExec
      • getJclEncoding

        public java.lang.String getJclEncoding()
        Return the encoding of the JCL
        Returns:
        the encoding of the JCL
      • setJclEncoding

        public void setJclEncoding(java.lang.String jclEncoding)
        Set the encoding of the JCL
        Parameters:
        jclEncoding - the encoding of the JCL
      • jclEncoding

        public JCLExec jclEncoding(java.lang.String jclEncoding)
        Set the encoding of the JCL
        Parameters:
        jclEncoding - the encoding of the JCL
        Returns:
        this instance of the JCLExec
      • getConfDir

        public java.lang.String getConfDir()
        Returns the configuration directory where jobOutput REXX script could be found
        Returns:
        the configuration directory where jobOutput REXX script could be found
      • setConfDir

        public void setConfDir(java.lang.String confDir)
        Set the configuration directory where jobOutput REXX script could be found
        Parameters:
        confDir - the configuration directory where jobOutput REXX script could be found
      • confDir

        public JCLExec confDir(java.lang.String confDir)
        Set the configuration directory where jobOutput REXX script could be found
        Parameters:
        confDir - the configuration directory where jobOutput REXX script could be found
        Returns:
        this instance of the JCLExec
      • getMaxRC

        public java.lang.String getMaxRC()
        Return the Max RC of the submitted job
        Returns:
        the max RC of the submitted job
      • getAllDDNames

        public java.util.List<java.lang.String> getAllDDNames()
                                                       throws BuildException
        Return all output DD names of the submitted job
        Returns:
        a list of output DD names of the submitted job
        Throws:
        BuildException - if an error occurred
      • getAllDDNames

        public java.util.List<java.lang.String> getAllDDNames(boolean qualified)
                                                       throws BuildException
        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 in saveOutput.
        Parameters:
        qualified - whether or not to retrieve qualified DD names
        Returns:
        a list of qualified output DD names of the submitted job
        Throws:
        BuildException - if an error occurred
      • 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 an error occurred
      • saveOutput

        public void saveOutput(java.io.File file,
                               java.lang.String encoding)
                        throws BuildException
        Save the output of the submitted job in a file on HFS
        Parameters:
        file - the target file to save the output to
        encoding - the encoding to be used to write the output
        Throws:
        BuildException - if an error occurred
      • 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 contains the output to be saved
        file - the target file to save the output to
        Throws:
        BuildException - if an error occurred
      • saveOutput

        public void saveOutput(java.lang.String ddName,
                               java.io.File file,
                               java.lang.String encoding)
                        throws BuildException
        Save the output of a specific DD in a file on HFS
        Parameters:
        ddName - the DD contains the output to be saved
        file - the target file to save the output to
        encoding - the encoding to be used to write the output
        Throws:
        BuildException - if an error occurred
      • saveOutput

        public void saveOutput(java.lang.String ddName,
                               java.io.File file,
                               boolean removeASA)
                        throws BuildException
        Save the output of a specific DD in a file on HFS
        Parameters:
        ddName - the DD contains the output to be saved
        file - the target file to save the output to
        removeASA - remove first character (ASA character) of each line of output
        Throws:
        BuildException - if an error occurred
      • saveOutput

        public void saveOutput(java.lang.String ddName,
                               java.io.File file,
                               java.lang.String encoding,
                               boolean removeASA)
                        throws BuildException
        Save the output of a specific DD in a file on HFS
        Parameters:
        ddName - the DD contains the output to be saved
        file - the target file to save the output to
        encoding - the encoding to be used to write the output
        removeASA - remove first character (ASA character) of each line of output
        Throws:
        BuildException - if an error occurred
      • saveOutput

        public void saveOutput(java.lang.String ddName,
                               java.lang.String sourceEncoding,
                               java.io.File file,
                               java.lang.String targetEncoding,
                               boolean removeASA)
                        throws BuildException
        Save the output of a specific DD in a file on HFS
        Parameters:
        ddName - the DD contains the output to be saved
        sourceEncoding - the encoding to be used to read the source
        file - the target file to save the output to
        targetEncoding - the encoding to be used to write the output
        removeASA - remove first character (ASA character) of each line of output
        Throws:
        BuildException - if an error occurred
      • 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 JCLExec 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.JCLExec
        Since:
        1.0.3

<IBM Copyright © 2018 IBM Corp. All Rights Reserved.