|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.jzos.DfSort
public class DfSort
This class provides a Java wrapper around the DFSORT utility.
DFSORT is useful for performing high-volume sort and merge operations. When invoked from Java, either the input can be taken from existing datasets or produced directly from Java. Likewise, the output from DFSORT can be written to a dataset or read directly back into Java. When writing from or reading into Java, java.io InputStreams and OutputStreams may be used to read and write data from the Java application to DFSORT.
For more information, see the following:
com.ibm.jzos.sample.dfsort
DFSORT DD allocations can be specified via addAllocation(String)
DFSORT control statements are specified via addControlStatement(String)
.
Constructor Summary | |
---|---|
DfSort()
|
Method Summary | |
---|---|
void |
addAllocation(java.lang.String allocation)
Add an allocation request to be sent to the DFSORT invocation. |
void |
addControlStatement(java.lang.String controlStatement)
Add a control statement to be sent to the DFSORT invocation. |
void |
disableInputStream()
Indicate that the records to DFSORT are to be provided via the SORTIN DD and not from Java. |
void |
disableOutputStream()
Indicate that the output records from DFSORT are to be sent to the SORTOUT DD and not to Java. |
void |
execute()
Run the jdfsort child process, which is a z/OS Java USS binary command wrapper for invoking DFSORT. |
java.io.OutputStream |
getChildStdinStream()
Returns a java.io.OutputStream that can be used to send records to the child DFSORT process. |
java.io.InputStream |
getChildStdoutStream()
Returns a java.io.InputStream that can be used to read output records from the child DFSORT process. |
int |
getReturnCode()
Wait for DFSORT to complete. |
java.util.List |
getStderrLines()
Return a list of stderr output lines (Strings) from the spawned DfSort process. |
boolean |
isSameAddressSpace()
Answer true if the child jdfsort process will be spawned in the same address space that is running the Java JVM. |
void |
setInputStreamHasRdws()
Indicate that the records to be sent as input to DFSORT are variable length, and that each record will prefixed by a 4 byte (big endian) RDW. |
void |
setInputStreamRecLen(int reclen)
Set a fixed record length for the records that will be sent as input to DFSORT. |
void |
setOutputStreamHasRdws()
Indicate that the records sent from DFSORT to java are variable length, and that each record will prefixed by a 4 byte (big endian) RDW. |
void |
setOutputStreamRecLen(int reclen)
Set a fixed record length for the records that will be received from DFSORT. |
void |
setSameAddressSpace(boolean separateAddressSpace)
If false, run the DFSORT child invocation process in the same address space as the JVM. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DfSort()
Method Detail |
---|
public void addAllocation(java.lang.String allocation)
The allocation strings are expected to be in the syntax required by BPXWDYN.
Typically, DFSORT may have allocations for the following DDs:
DfSort dfSort = new DfSort();
dfSort.addAllocation("alloc fi(sortin) da('HLQ.MY.DATASET') reuse shr msg(2)");
public void addControlStatement(java.lang.String controlStatement)
DfSort dfSort = new DfSort();
dfSort.addControlStatement("SORT FIELDS=(1,80,CH,A)");
public void setInputStreamRecLen(int reclen)
This method is mutually exclusive with setInputStreamHasRdws()
and disableInputStream()
.
reclen
- int the input record length for fixed recordsgetChildStdinStream()
,
addControlStatement(String)
public void setInputStreamHasRdws()
This method is mutually exclusive with setInputStreamRecLen(int)
and disableInputStream()
.
getChildStdinStream()
,
addControlStatement(String)
public void disableInputStream()
This method is mutually exclusive with setInputStreamRecLen(int)
and setInputStreamHasRdws()
.
public void setOutputStreamRecLen(int reclen)
This method is mutually exclusive with setOutputStreamHasRdws()
and disableOutputStream()
.
reclen
- int the output record length for fixed recordsgetChildStdoutStream()
,
addControlStatement(String)
public void setOutputStreamHasRdws()
This method is mutually exclusive with setOutputStreamRecLen(int)
and disableOutputStream()
.
getChildStdoutStream()
,
addControlStatement(String)
public void disableOutputStream()
This method is mutually exclusive with setOutputStreamRecLen(int)
and setOutputStreamHasRdws()
.
public java.io.OutputStream getChildStdinStream()
The data sent to this stream should be fixed length records
if setInputStreamRecLen(int)()
has been used, or
RDW-prefixed records if setInputStreamHasRdws()
has been used.
If however, disableInputStream()
was set (the default), then this
stream has no use, as input to DFSORT will come from DD:SORTIN.
For best performance, this OutputStream should be wrapped in a BufferedOutputStream.
To write RDW-prefixed records, see RDWOutputRecordStream
.
java.lang.IllegalStateException
- if called before execute()
public java.io.InputStream getChildStdoutStream()
The data sent to this stream should be fixed length records
if setOutputStreamRecLen(int)()
has been used, or
RDW-prefixed records if setOutputStreamHasRdws()
has been used.
If however, disableOutputStream()
was set (the default), then this
stream has no use, as output from DFSORT will go to DD:SORTOUT.
For best performance, this InputStream should be wrapped in a BufferedInputStream.
To read RDW-prefixed records, see RDWInputRecordStream
.
java.lang.IllegalStateException
- if called before execute()
public void execute() throws ErrnoException
ErrnoException
- if there is a failure launching the child processpublic int getReturnCode()
RcException
- if the child process terminates abnormally without a return codepublic java.util.List getStderrLines()
isSameAddressSpace()
= false.
Otherwise, DFSORT messages will be written to java's stderr.
public boolean isSameAddressSpace()
setSameAddressSpace(boolean)
public void setSameAddressSpace(boolean separateAddressSpace)
isSameAddressSpace()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |