Module ibm.jzos
Package com.ibm.jzos

Class ZFileRecordReader

java.lang.Object
com.ibm.jzos.RecordReader
com.ibm.jzos.ZFileRecordReader
All Implemented Interfaces:
ZFileConstants

public class ZFileRecordReader extends RecordReader implements ZFileConstants
This ZFile wrapper is no longer the most efficient way to read dataset records. Please see RecordReader.

In order to provide more efficient dataset record mode read performance, it is often beneficial to read a block, rather than a record, at a time from the underlying dataset. This class wraps an instance of ZFile, re-opens it with RECFM=U, and provides an interface for reading a record at a time. The underlying ZFile must have been opened with the following options:

  • type=record
  • read mode, either text or binary ("r", "rb" or "rt")

Reading the dataset a block at a time limits the number of calls to the C library fread() function and also reduces the number of JNI calls that need to be made. The z/OS XL C/C++ Programming Guide SC09-4765 (Chapter 34 - I/O Performance considerations) recommends taking this approach to increase performance when possible.

All record formats are supported, however performance gains will only be realized when the average record lengths are significantly less than the average block size.

Since:
2.3.0
See Also: