Class DataSetWriter

  • All Implemented Interfaces:
    Closeable, Flushable, Appendable, AutoCloseable

    public class DataSetWriter
    extends Writer
    Writes text to a z/OS dataset, providing for the efficient writing of characters.

    When an instance is constructed, an exclusive enqueue will be obtained on the associated dataset. If an enqueue could not be obtained, an exception will be thrown.

    The data written must be in UTF-8 encoding and will be encoded using the code page specified in the credentials of the associated host. If any binary characters were mapped to UTF-8 (see DataSetReader), they will be translated back to binary bytes. If unmappable characters are part of any write, an exception will be thrown and the text will not be written.

    If the logical record length of the dataset is exceeded during any write, an exception will be thrown and the text will not be written.

    When close is called, the data will be written on the host and the enqueue will be released.

    For efficient writing of dataset records, it is advisable to wrap a BufferedWriter around a DataSetWriter. For example,

    BufferedWriter out = new BufferedWriter(new DataSetWriter(...));

    Regarding parameter validation for the methods within this class:

    A dataset name is considered invalid if:

    • The total length of the name is 0 or is greater than 44 characters.
    • The length of any qualifier within the name is 0 or is greater than 8 characters.
    • Qualifiers are delimited by anything other than a '.' character.
    • Any characters outside of the code page 1047 hex values for A-Z, a-z, 0-9, @, #, $, or - are present.
    • Any qualifier (and hence the name itself) starts with a digit (0-9) or a hyphen (-).
    Since:
    1.1.0
    Version:
    2.0.0
    See Also:
    ISequentialDataSet
    Restriction:
    This class is not intended to be extended by clients.