RecordOrientedDataSetWriterPattern

The RecordOrientedDataSetWriterPattern pattern is used to write data to a z/OS® data set.

Supporting classes

  • ZFileStreamOrientedTextWriter: Writes text data
  • ZFileStreamOrientedByteWriter: Writes byte data
  • ZFileRecordOrientedDataWriter: Writes sequential data

Required properties

The following properties are required for the pattern.

Table 1. Required properties . The table includes the name, value, and description of each required property for the pattern.
Property name Value Description
PATTERN_IMPL_CLASS Java™ class name Class implementing RecordOrientedDatasetWriterPattern interface
DSNAME Data set name For example, USER216.BATCH.RECORD.OUTPUT

Optional properties

The following properties are optional for the pattern.

Table 2. Optional properties . The table includes the name, value, and description of each optional property for the pattern.
Property name Value Description
ds_parameters Parameters used to open the data set. Default for ZFileRecordOrientedDataWriter is wb,recfm=fb,type=record,lrecl=80 and

Default for

ZFileStreamOrientedByteWriter and ZFileStreamOrientedTextWriter are wt
debug true or false (default is false) Enables detailed tracing on this batch datastream.
EnablePerformanceMeasurement true or false (default is false) Calculates the total time spent in the batch data-streams and the processRecord method, if you are using the GenericXDBatchStep.
EnableDetailedPerformanceMeasurement true or false (default is false) Provides a more detailed breakdown of time spent in each method of the batch data-streams.
file.encoding Encoding of the file. For example, CP1047

Interface definition

/**
 * 
 * This pattern is used to write data to z/OS dataset using
 * jzos apis
 */
public interface RecordOrientedDatasetWriterPattern {

	/**
	 * This method is called during the job setup phase allowing
	 * the user to do initialization.
	 * The properties are the ones passed in the xJCL
	 * @param props
	 */
	public void initialize(Properties props);
	
	/**
	 * This method should be used to write the given
	 * object into the dataset
	 * @param out
	 * @param record
	 * @throws IOException
	 */
	public void writeRecord(ZFile out, Object record) throws IOException;
	
	/**
	 * This method should be used to write header information
	 * if any
	 * @param out
	 * @throws IOException
	 */
	public void writeHeader(ZFile out) throws IOException;
	
	/**
	 * This method can be optionally called during process step to explicity 
	 * initialize and write the header. 
	 * @param header
	 */
	public void writeHeader(ZFile out, Object header);
	
}

xJCL example

<batch-data-streams>
<bds>
<logical-name>outputStream</logical-name>
<props>
<prop name="PATTERN_IMPL_CLASS" value="com.ibm.websphere.batch.samples.tests.bds.EchoWriter"/>
<prop name="DSNAME" value="USER216.BATCH.RECORD.OUTPUT"/>
<prop name="ds_parameters" value="wt"/>
<prop name="file.encoding" value="CP1047"/>
<prop name="debug" value="${debug}"/>
</props>
<impl-class>com.ibm.websphere.batch.devframework.datastreams.patterns.ZFileStreamOrientedByteWriter</impl-class>
</bds>
</batch-data-streams>