Deleting a Data set

To delete a partitioned, sequential, migrated or VSAM data set using an IDataSet:

IDataSet dataset = ...

try {
    dataset.delete();
} catch (DataSetAccessException e) {
    // the user does not have access to this dataset
    ...
} catch (DataSetInUseException e) {
    // the dataset is enqueued by another user or job
    ...
}

To delete a partitioned, sequential, migrated or VSAM dataset using an IDatasetCommandProvider:

IDataSetCommandProvider commandProvider = ...
String datasetName = ...

try {
    commandProvider.deleteDataSet(datasetName);
} catch (IllegalArgumentException e) {
    // invalid dataset name
    ...
} catch (DataSetAccessException e) {
    // the user does not have access to this dataset
    ...
} catch (DataSetInUseException e) {
    // the dataset is enqueued by another user or job
    ...
} catch (DataSetNotFoundException e) {
    // the dataset could not be found
    ...
}
Was this page helpful? Yes No Submitting... Thank you

Comments