|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.jzos.sample.MvsJobSubmitter
public class MvsJobSubmitter
Sample program which submits a job to the internal reader,
returning a 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.
Field Summary | |
---|---|
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 Summary | |
---|---|
MvsJobSubmitter()
Construct an instance, which causes the "submitJob" Rexx script to be started to receive our JCL. |
Method Summary | |
---|---|
protected static void |
copyFile(java.lang.String filename,
java.io.Writer writer)
Copy a file given its name to a Writer. |
protected void |
executeSubmit()
Start the "submitJob" child process. |
protected static java.lang.String[] |
getEnvironment()
|
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. |
protected static java.lang.String |
getStatusCommand(MvsJob job)
|
protected static java.lang.String |
getSubmitCommand()
|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
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
Constructor Detail |
---|
public MvsJobSubmitter() throws java.io.IOException
java.io.IOException
Method Detail |
---|
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 processprotected void executeSubmit() throws java.io.IOException
java.io.IOException
protected static java.lang.String getSubmitCommand()
protected static java.lang.String getStatusCommand(MvsJob job)
protected static java.lang.String[] getEnvironment()
protected static void copyFile(java.lang.String filename, java.io.Writer writer) throws java.io.IOException
java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |