Writing content to a PDS member
To write to a PDS member from an IPartitionedDataSetMember:
IPartitionedDataSetMember partitionedDataSetMember = ...
memberContents = ...
// create a BufferedWriter wrapping a new MemberWriter using a
// try-with-resource statement
try (BufferedWriter writer = new BufferedWriter(new MemberWriter(
partitionedDataSetMember))) {
// write the partitioned dataset member data using the writer
writer.write(memberContents);
} catch (DataSetAccessException e) {
// the user does not have access to the partitioned dataset
...
} catch (DataSetInUseException e) {
// the partitioned dataset is enqueued by another user or job
...
} catch (DataSetMigratedException e) {
// the partitioned dataset has been migrated since it was first
// retrieved
...
} catch (DataSetNotFoundException e) {
// the partitioned dataset can no longer be found
...
} catch (MemberNotFoundException e) {
// the partitioned dataset member can no longer be found
...
} catch (MemberInUseException e) {
// the partitioned dataset member is enqueued by another use or job
...
} catch (IOException e) {
// an IO error has occurred writing the dataset member and/or closing the writer
...
}
To write to a PDS member using an IZOSHostConnection:
IZOSHostConnection zosHostConnection = ...
String pdsName = ...
String memberName = ...
memberContents = ...
// create a BufferedWriter wrapping a new MemberWriter using a
// try-with-resource statement
try (BufferedWriter writer = new BufferedWriter(new MemberWriter(
zosHostConnection, pdsName, memberName))) {
// write the partitioned dataset member data using the writer
writer.write(memberContents);
} catch (DataSetAccessException e) {
// the user does not have access to the partitioned dataset
...
} catch (DataSetInUseException e) {
// the partitioned dataset is enqueued by another user or job
...
} catch (DataSetMigratedException e) {
// the partitioned dataset is migrated
...
} catch (DataSetNotFoundException e) {
// the partitioned dataset could not be found or is not a
// partitioned dataset
...
} catch (MemberNotFoundException e) {
// the partitioned dataset member could not be found
...
} catch (MemberInUseException e) {
// the partitioned dataset member is enqueued by another use or job
...
} catch (IOException e) {
// an IO error has occurred writing the dataset member and/or closing the writer
...
}
Related topics
Was this page helpful? Yes No
Submitting...
Thank you
Comments
Log in or register to comment.