Class ZosBatchSuppliedJobcard

java.lang.Object
dev.galasa.zosbatch.spi.ZosBatchSuppliedJobcard

public final class ZosBatchSuppliedJobcard extends Object
Locates and parses the JOB statement in JCL that already contains its own JOB statement, and builds the JCL to be submitted. Shared by the z/OS Batch Manager implementations so that they behave identically.

The first record of the JCL that is not blank and not a comment (//*) must be the JOB statement, //jobname JOB .... The JOB statement may be continued over more than one record. A statement is continued when the operand field ends with a comma or a quoted string is not closed. Each continuation record must start with // followed by a blank. Comment records within a continued statement are considered part of the statement.

  • Method Details

    • getJobname

      public String getJobname()
      Returns:
      the job name from the JOB statement, in upper case
    • getEndOffset

      public int getEndOffset()
      Returns:
      the offset into the parsed JCL immediately after the last record of the JOB statement, including its line terminator if it has one
    • parse

      public static ZosBatchSuppliedJobcard parse(String jcl) throws ZosBatchException
      Parse the JOB statement from the supplied JCL. The returned instance represents the supplied JCL, and build(String) builds the JCL to be submitted from it.
      Parameters:
      jcl - the JCL, which must start with a JOB statement
      Returns:
      the parsed JOB statement
      Throws:
      ZosBatchException - if a valid JOB statement is not found
    • build

      public String build(String sysaffImageId)
      Build the JCL to be submitted from the JCL that this instance was parsed from. The JCL is unchanged except that:
      • if a SYSAFF image is provided and the JCL does not already contain a /*JOBPARM record with SYSAFF=, a /*JOBPARM SYSAFF=[image] record is inserted immediately after the last record of the JOB statement
      • a line terminator is added to the end if there is not one
      Parameters:
      sysaffImageId - the image ID to use for SYSAFF, or null to not add a SYSAFF record
      Returns:
      the JCL to be submitted