Interface IDataSet

  • All Superinterfaces:
    IHostResource
    All Known Subinterfaces:
    IMigratedDataSet, IPartitionedDataSet, ISequentialDataSet, IVSAMCluster

    public interface IDataSet
    extends IHostResource
    A dataset that resides on a z/OS host.

    For details on the state of an IDataSet and the function of its methods, see IHostResource.

    Examples:
    To retrieve a dataset:

     IDataSetCommandProvider commandProvider = ...
     String dataSetName = ...
     
     // dataSet will be null if it cannot be found
     IDataSet dataSet = commandProvider.findDataSet(dataSetName);
     
    To retrieve a list of datasets matching a filter:
     IDataSetCommandProvider commandProvider = ...
     String dataSetFilter = ...
     
     // dataSets will be empty if no datasets match the dataset filter
     List<IDataSet> dataSets = commandProvider.findDataSets(dataSetFilter);
     
    To retrieve a specific generation dataset of a generation data group from an IDataSetCommandProvider:
     IDataSetCommandProvider commandProvider = ...
     String generationDataGroupName = ...
     int relativeGenerationNumber = ...
     
     // generationDataSet will be null if the generation data
     // group does not exist or a generation dataset does not exist for the
     // specified relative generation number
     IDataSet generationDataSet = commandProvider.findGenerationDataSet(
             generationDataGroupName, relativeGenerationNumber);
     
    To retrieve a specific generation dataset of a generation data group from an IGenerationDataGroup:
     IGenerationDataGroup generationDataGroup = ...
     int relativeGenerationNumber = ...
     
     // generationDataSet will be null if a generation dataset
     // does not exist for the specified relative generation number
     IDataSet generationDataSet = generationDataGroup
             .findGenerationDataSet(relativeGenerationNumber);
     
    To retrieve a list of all generation datasets of a generation data group from an IDataSetCommandProvider:
     IDataSetCommandProvider commandProvider = ...
     String generationDataGroupName = ...
     
     // generationDataSets will be empty if the generation data group does
     // not haven any generation datasets
     List<IDataSet> generationDataSets = commandProvider
             .fetchGenerationDataSets(generationDataGroupName);
     
    To retrieve a list of all generation datasets of a generation data group from an IGenerationDataGroup:
     IGenerationDataGroup generationDataGroup = ...
     
     // generationDataSets will be empty if the generation data group does
     // not haven any generation datasets
     List<IDataSet> generationDataSets = generationDataGroup
             .fetchGenerationDataSets();
     
    To delete a 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
         ...
     }
     
    To delete a dataset 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
         ...
     }
     
    For examples on how to obtain an IDataSetCommandProvider, see IDataSetCommandProvider.
    For examples on how to retrieve specific subclasses of IDataSet, see IPartitionedDataSet, ISequentialDataSet, IVSAMCluster, and IMigratedDataSet.
    For examples on how to retrieve a specific generation dataset, typed as an ISequentialDataSet, see ISequentialDataSet.
    Since:
    1.0.0
    Version:
    2.0.0
    Restriction:
    This interface is not intended to be extended by clients.
    Restriction:
    This interface is not intended to be implemented by clients.
    • Method Detail

      • fetchCharacteristics

        IDataSetCharacteristics fetchCharacteristics()
                                              throws DataSetAccessException,
                                                     DataSetInUseException,
                                                     DataSetMigratedException,
                                                     DataSetNotFoundException
        Fetches the characteristics of this dataset from the z/OS host on which it resides.

        The state of the dataset characteristics returned from this method is a snapshot of these characteristics from the time this method is called. Any changes made to these characteristics after this method is called will not be reflected in any previously returned dataset characteristics. This method may be called again to retrieve a current snapshot of the data set characteristics.

        Returns:
        the dataset characteristics
        Throws:
        ZOSSystemException - if a z/OS system error occurs
        ZOSAbendException - if a z/OS ABEND occurs
        DataSetAccessException - if the user's credentials do not grant access authority for this dataset
        DataSetInUseException - if an exclusive enqueue exists on this dataset
        DataSetMigratedException - if this dataset is migrated (this may occur if the dataset is migrated after it is retrieved from the z/OS host)
        DataSetNotFoundException - if this dataset no longer exists (this may occur if the dataset is deleted after it is retrieved from the z/OS host)
        Since:
        1.0.0
      • getType

        DataSetType getType()
        Returns the type of this host resource.

        Note: the value returned from this method represents the state of this host resource from the time it was retrieved from the host. Any changes made to this host resource since it was retrieved will not be reflected in this method.

        Specified by:
        getType in interface IHostResource
        Returns:
        the dataset type
        Since:
        1.0.0
      • isAlias

        boolean isAlias()
        Returns whether this dataset is an alias.
        Returns:
        true if this dataset is an alias, false otherwise
        Since:
        1.1.0