Method Detail - mfx - 3.1

Syncsort™ MFX Programmers Guide

Product type
Software
Portfolio
Integrate
Product family
Syncsort™ Software
Product
Syncsort™ MFX > MFX
Version
3.1
Language
English
Content type
Programmer’s Guide
Product name
Syncsort™ MFX
Title
Syncsort™ MFX Programmers Guide
Copyright
2024
First publish date
2010
Last updated
2024-11-06
Published on
2024-11-06T17:38:26.716054

addAllocation

public void addAllocation(java.lang.String allocation)

Add an allocation request to be sent to the Syncsort™ MFX invocation.

The allocation strings are expected to be in the syntax required by BPXWDYN.

Typically, Syncsort™ MFX may have allocations for the following DDs:

  • SORTIN – where Syncsort™ MFX gets sort/merge input.

  • SORTOUT – where Syncsort™ MFX writes sort/merge output

Example:

Syncsort syncsort = new Syncsort(); syncsort.addAllocation

("alloc fi(sortin) da('HLQ.MY.DATASET') reuse shr msg(2)");
Note: Allocation requests must be added before calling execute() in order to have any effect.

addControlStatement

public void addControlStatement(java.lang.String controlStatement)

Add a control statement to be sent to the Syncsort™ MFX invocation.

Example:

Syncsort syncsort = new Syncsort(); syncsort.addControlStatement("SORT FIELDS=(1,80,CH,A)");
Note: Control statements must be added before calling execute() in order to have any effect.

setInputStreamRecLen

public void setInputStreamRecLen(int reclen)

Set a fixed record length for the records that will be sent as input to Syncsort™ MFX. This length must match the record length expected by Syncsort™ MFX as specified by the RECORD control statement.

This method is mutually exclusive with setInputStreamHasRdws() and disableInputStream().
Note: This property must be changed before calling execute() in order to have any effect.

Parameters:

reclen – int the input record length for fixed records

setInputStreamHasRdws

public void setInputStreamHasRdws()

Indicate that the records to be sent as input to Syncsort™ MFX are variable length, and that each record will prefixed by a 4-byte (big endian) RDW. This RDW value must be less than or equal to the maximum record length expected by Syncsort™ MFX as specified by the RECORD control statement. The RECORD control statement must indicate that Syncsort MFX is to expect variable length records.
Note: This property must be changed before calling execute() in order to have any effect.

This method is mutually exclusive with setInputStreamRecLen(int) and disableInputStream().

disableInputStream

public void disableInputStream()

Indicate that the records to Syncsort™ MFX are to be provided via the SORTIN DD and not from Java.
Note: This property must be changed before calling execute() in order to have any effect.

This method is mutually exclusive with setInputStreamRecLen(int) and setInputStreamHasRdws().

setOutputStreamRecLen

public void setOutputStreamRecLen(int reclen)

Set a fixed record length for the records that will be received from Syncsort™ MFX. This length must match the record length produced by Syncsort™ MFX as specified by the RECORD control statement.
Note: This property must be changed before calling execute() in order to have any effect.

This method is mutually exclusive with setOutputStreamHasRdws() and disableOutputStream().

Parameters:

reclen – int the output record length for fixed records.

setOutputStreamHasRdws

public void setOutputStreamHasRdws()

Indicate that the records sent from Syncsort™ MFX to Java are variable length, and that each record will prefixed by a 4-byte (big endian) RDW. This RDW value will be less than or equal to the maximum record length as specified by the RECORD control statement. The RECORD control statement must indicate that Syncsort™ MFX is to produce variable length records.
Note: This property must be changed before calling execute() in order to have any effect.

This method is mutually exclusive with setOutputStreamRecLen(int) and disableOutputStream().

disableOutputStream

public void disableOutputStream()

Indicate that the output records from Syncsort™ MFX are to be sent to the SORTOUT DD and not to Java.
Note: This property must be changed before calling execute() in order to have any effect.

This method is mutually exclusive with setOutputStreamRecLen(int) and setOutputStreamHasRdws().

getChildStdinStream

public java.io.OutputStream getChildStdinStream()

Returns a java.io.OutputStream that can be used to send records to the child Syncsort™ MFX process. This data stream is used to provide input to Syncsort™ MFX via a sort input exit as an alternative to DD:SORTIN.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 Syncsort™ MFX will come from DD:SORTIN. For better performance, this OutputStream should be wrapped in a BufferedOutputStream.

Returns:

java.io.OutputStream

Throws:

java.lang.IllegalStateException – if called before execute()

getChildStdoutStream

public java.io.InputStream getChildStdoutStream()

Returns a java.io.InputStream that can be used to read output records from the child Syncsort™ MFX process. This data stream will contain sorted output data from Syncsort™ MFX via a sort output exit as an alternative to DD:SORTOUT. 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 Syncsort™ MFX will go to DD:SORTOUT.

For better performance, this InputStream should be wrapped in a BufferedInputStream.

Returns:

java.io.InputStream

Throws:

java.lang.IllegalStateException – if called before execute().

getReturnCode

public int getReturnCode()

Wait for Syncsort™ MFX to complete. This method should be called after execute() and after I/O from the child’s stdin and/or stdout has been processed.

Returns:

int – the Syncsort™ MFX return code. Value unpredictable if called before execute().

Throws:

RcException –if the child process terminates abnormally without a return code.

getStderrLines

public java.util.List getStderrLines()

Return a list of stderr output lines (Strings) from the spawned Syncsort™ MFX process. This method only applies if isSameAddressSpace() = false. Otherwise, Syncsort™ MFX messages will be written to Java’s stderr.

Returns:

List – a list of strings.

setSameAddressSpace

public void setSameAddressSpace(boolean same)

Sets whether the child Syncsort™ MFX process will be spawned in the same address space as the Java JVM, or in a separate/new BPX address space.

Parameters:

same – flag to indicate whether the Syncsort™ MFX child invocation process should run in the same address space as the JVM. If true, run the Syncsort™ MFX child invocation process in the same address space as the JVM. If false, spawn a new address space.