public class MvsJobSubmitter
extends java.lang.Object
MvsJob
object containing the jobname and jobid.
The class relies on sample Rexx scripts spawned as a child process
via the Exec
class.
The JZOS ZFile class can be used to submit JCL if you use ZFile.bpxwdyn(String)
to allocate a DD to "SYSOUT(A) WRITER(INTRDR)", but this mechanism does not have the
ability to return the submitted job id (JOBnnnnn). Fortunately, the Rexx "submit()" function
has the ability to submit JCL and get the jobid back, so this example shows how to attach
a sample USS Rexx script ("submitJob") as a child process and send it JCL on its stdin handle.
In order for JZOS to find the sample REXX script, the System property jzos.script.path must be set to point to the sample scripts directory. See the Installation Guide for details.
Similarly, getting status for an executing job requires an APF authorized program interface to the subsystem api. The TSO "STATUS" command can be executed via the Rexx "TSO" command processor to obtain this information. See the sample "jobStatus" Rexx script.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
JOB_STATUS_CMD |
static long |
ONE_MINUTE |
static long |
ONE_SECOND |
static java.lang.String |
SUBMIT_JOB_CMD |
static long |
TWO_SECONDS |
Constructor and Description |
---|
MvsJobSubmitter()
Construct an instance, which causes the "submitJob" Rexx script to
be started to receive our JCL.
|
Modifier and Type | Method and Description |
---|---|
java.io.Writer |
getInternalReaderWriter()
Answers a writer that can be used by the client to
send JCL to the Rexx submitJob process.
|
static java.lang.String |
getJobStatus(MvsJob job)
Returns the status for a job using the TSO "status" command,
which is invoked via the "jobStatus" REXX USS script.
|
static void |
main(java.lang.String[] args)
A sample main method that submits JCL read from a file and then
polls its status (for up to a minute) until it is complete.
|
MvsJob |
submitJob()
Answers an MvsJob object which is a simple bean holding the
submitted jobname and userid.
|
public static final long ONE_SECOND
public static final long TWO_SECONDS
public static final long ONE_MINUTE
public static final java.lang.String SUBMIT_JOB_CMD
public static final java.lang.String JOB_STATUS_CMD
public MvsJobSubmitter() throws java.io.IOException
java.io.IOException
public static void main(java.lang.String[] args) throws java.io.IOException
The first argument to main can be a Unix file/path name
or a "//dataset.name". The name is given directory to
the FileFactory.newBufferedReader(String)
method
to open the JCL file to submit.
java.io.IOException
public java.io.Writer getInternalReaderWriter() throws java.io.IOException
java.io.IOException
public MvsJob submitJob() throws java.io.IOException
java.io.IOException
- if there is an error communicating with the child Rexx process
or if the child process had an error submitting the process.public static java.lang.String getJobStatus(MvsJob job) throws java.io.IOException
java.io.IOException
- if there was an error communicating with the child REXX script process