Allocating partitioned or sequential data sets
In order to allocate partitioned or sequential data sets, you first must create the allocate parameters using an AllocateParametersBuilder. After creating your allocate parameters, you can then allocate your data sets using an IDatasetCommandProvider.
To create allocate parameters based off of an existing data set:
IPartitionedDataSet dataset = ...
try {
IAllocateParameters parameters = AllocateParametersBuilder.like(dataset).build();
} catch (DataSetInUseException e1) {
// the dataset is enqueued by another user or job
...
} catch (DataSetNotFoundException e1) {
// the dataset can no longer be found
...
} catch (DataSetAccessException e1) {
// the user does not have access to this dataset
...
} catch (DataSetMigratedException e1) {
// the dataset has been migrated since it was first retrieved
...
}
To create allocate parameters based off of an existing data set while overriding some parameters:
IPartitionedDataSet dataset = ...
try {
IAllocateParameters parameters = AllocateParametersBuilder.like(dataset)
.setRecordFormat(RecordFormat.VB).setLogicalRecordLength(120).setBlockSize(124).build();
// alternatively:
AllocateParametersBuilder builder = AllocateParametersBuilder.like(dataset);
builder.setRecordFormat(RecordFormat.VB);
builder.setLogicalRecordLength(120);
builder.setBlockSize(124);
IAllocateParameters parameters2 = builder.build();
} catch (DataSetInUseException e1) {
// the dataset is enqueued by another user or job
...
} catch (DataSetNotFoundException e1) {
// the dataset can no longer be found
...
} catch (DataSetAccessException e1) {
// the user does not have access to this dataset
...
} catch (DataSetMigratedException e1) {
// the dataset has been migrated since it was first retrieved
...
}
To create allocate parameters for a partitioned data set based off of defaults:
.setAllocationUnit(IAllocateParameters.AllocationUnit.CYLINDERS).setPrimaryQuantity(5)
.setSecondaryQuantity(2).build();
// alternatively:
AllocateParametersBuilder builder = AllocateParametersBuilder.partitionedDefaults(true);
builder.setAllocationUnit(IAllocateParameters.AllocationUnit.CYLINDERS);
builder.setPrimaryQuantity(5);
builder.setSecondaryQuantity(2);
IAllocateParameters parameters2 = builder.build();
To create allocate parameters for a sequential data set based off of defaults:
.setAllocationUnit(IAllocateParameters.AllocationUnit.CYLINDERS).setPrimaryQuantity(5)
.setSecondaryQuantity(2).build();
// alternatively:
AllocateParametersBuilder builder = AllocateParametersBuilder.sequentialDefaults();
builder.setAllocationUnit(IAllocateParameters.AllocationUnit.CYLINDERS);
builder.setPrimaryQuantity(5);
builder.setSecondaryQuantity(2);
IAllocateParameters parameters2 = builder.build();
To allocate a partitioned data set:
String dataSetName = ...
IAllocateParameters parameters = ...
try {
commandProvider.allocatePartitionedDataSet(dataSetName, parameters);
} catch (DataSetExistsException e) {
// the dataset already exists
...
} catch (AllocationFailedException e) {
// the allocation failed - most likely because the user does not have the proper authority
...
}
To allocate a sequential data set:
String dataSetName = ...
IAllocateParameters parameters = ...
try {
commandProvider.allocateSequentialDataSet(dataSetName, parameters);
} catch (DataSetExistsException e) {
// the dataset already exists
...
} catch (AllocationFailedException e) {
// the allocation failed - most likely because the user does not have the proper authority
...
}
Related topics