jdfsort, getChildStdinStream() and getChildStdoutStream()

General discussion on the JZOS batch launcher and toolkit
Post Reply
Cogito-Ergo-Sum
Posts: 30
Joined: Thu Jan 25, 2007 8:31 am
Location: Bengaluru, India

jdfsort, getChildStdinStream() and getChildStdoutStream()

Post by Cogito-Ergo-Sum »

Hi,
I have a few questions about jdfosrt usage.

1. Would it be correct to say that the usage of getChildStdinStream() and getChildStdoutStream() is to emulate the E15 and E35 type of exits when executing DFSORT ?

2. E15 and E35 can be used in conjunction with SORTIN and SORTOUT respectively. However, getChildStdinStream() and getChildStdoutStream() make E15 and E35 exclusive of SORTIN and SORTOUT. Is this valid ?

3. When using jdfsort with E15 or E35 exits, should the output of these exits goto OutputStream and InputStream objects respectively ?

4. When run in a job step, a dataset is automatically allocated to a given DD name. Why is then addAllocation(java.lang.String allocation) required ?

5. Finally, in the javadoc, for getChildStdoutStream() the following is mentioned :
For best performance, this OutputStream should be wrapped in a BufferedInputStream. To read RDW-prefixed records, see RDWInputRecordStream.
The OutputStream should have been InputStream ? :wink:
Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
--Sherlock Holmes
coz
Posts: 391
Joined: Fri Jul 30, 2004 5:29 pm

Post by coz »

Good questions.

1.) Yes

2.) In the JZOS implementation of DFSORT, these usages are mutually exclusive. That is, you can either use getChildStdinStream() or supply a SORTIN DD.

3.) JZOS wraps an implementation of E15 and E35 and provides stream level access via getChildStdinStream() and getChildStdoutStream()

4.) You're right. In the case you describe, you do not need to supply the allocation. However, if you have set setSameAddressSpace(false), you will need to supply these allocations as DFSORT will not have visibility to the DDs specified on the job step.

5.) Good catch. We'll update the documentation.
Cogito-Ergo-Sum
Posts: 30
Joined: Thu Jan 25, 2007 8:31 am
Location: Bengaluru, India

Post by Cogito-Ergo-Sum »

Thank you, Steve.
3.) JZOS wraps an implementation of E15 and E35 and provides stream level access via getChildStdinStream() and getChildStdoutStream()
Sorry...I didn't quite follow that.

When executing DFSORT with an E15 exit, then DFSORT "picks" up the record when the exit is over. The exit does not write that record anywhere. DFSORT will re-enter unless the return code (in register 14) is set otherwise. Is this applicable for jdfsort too ?

However, in case of getChildStdinStream() , would the E15 exit write to the stream instead and set the return code ?

Steve,
It would be really nice if you can show a simple example.
Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
--Sherlock Holmes
coz
Posts: 391
Joined: Fri Jul 30, 2004 5:29 pm

Post by coz »

It would be really nice if you can show a simple example.
Have you taken a look at the sample code in com.ibm.jzos.sample.dfsort?

These six example classes show the various ways that DFSORT can be called from JZOS. Here's some information on three of these examples. The javadoc (and source code) provides more details.

com.ibm.jzos.sample.dfsort.DfSortFixedDatasetToFixedDataset
Calls DFSORT, supplying SORTIN and SORTOUT DDs. No input or output streams from Java are used in this example.

com.ibm.jzos.sample.dfsort.DfSortFixedDatasetToJava
Calls DFSORT, supplying a SORTIN DD. In this example, sort output is written to java (see the call to setOutputStreamRecLen() in the sample code). In this case, an E35 exit is established automatically to read the output records from DFSORT and route to java where they are read from the child output stream.

com.ibm.jzos.sample.dfsort.DfSortFixedJavaToDataset
Calls DFSORT, supplying a SORTOUT DD. Sort input is generated by the java sample code and sent to the jdfsort child input stream (and routed to an established E15 exit).
Cogito-Ergo-Sum
Posts: 30
Joined: Thu Jan 25, 2007 8:31 am
Location: Bengaluru, India

Post by Cogito-Ergo-Sum »

Hi Steve,
No, I hadn't. Sorry. Now, I will.

Thanks for your responses !
Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
--Sherlock Holmes
Post Reply