!
! The following example shows how to create an empty dataset,
! and split the meta data and data into separate files. 
!

     PROGRAM DSETSPLIT

     USE HDF5 ! This module contains all necessary modules 
        
     IMPLICIT NONE

     CHARACTER(LEN=6), PARAMETER :: filename = "splitf"   ! File name
     CHARACTER(LEN=4), PARAMETER :: dsetname = "dset"     ! Dataset name

     INTEGER(HID_T) :: file_id       ! File identifier 
     INTEGER(HID_T) :: dset_id       ! Dataset identifier 
     INTEGER(HID_T) :: dspace_id     ! Dataspace identifier
     INTEGER(HID_T) :: fapl          ! File Access Property List ID


     INTEGER(HSIZE_T), DIMENSION(2) :: dims = (/4,6/) ! Dataset dimensions
     INTEGER     ::   rank = 2                        ! Dataset rank

     INTEGER     ::   error ! Error flag

     ! Initialize FORTRAN predefined datatypes.
     !
     CALL h5open_f (error)

     ! Set up split file access property
     !
     CALL h5pcreate_f (H5P_FILE_ACCESS_F, fapl, error)
     CALL h5pset_fapl_split_f (fapl, ".met", H5P_DEFAULT_F, ".dat", &
                                H5P_DEFAULT_F, error)
  
     ! Create a new file 
     ! 
     CALL h5fcreate_f (filename, H5F_ACC_TRUNC_F, file_id, error, &
                       H5P_DEFAULT_F, fapl)

     ! Create the dataspace.
     !
     CALL h5screate_simple_f (rank, dims, dspace_id, error)

     ! Create the dataset with default properties.
     !
     CALL h5dcreate_f (file_id, dsetname, H5T_NATIVE_INTEGER, dspace_id, &
                       dset_id, error)

     ! End access to the dataset, dataspace, property list, and file.
     ! 
     CALL h5dclose_f (dset_id, error)
     CALL h5sclose_f (dspace_id, error)
     CALL h5pclose_f (fapl, error)
     CALL h5fclose_f (file_id, error)

     ! Close FORTRAN predefined datatypes.
     !
     CALL h5close_f (error)

     END PROGRAM DSETSPLIT
     
 

