program hdf5_test
  use HDF5

  implicit none

  character(len=8), parameter :: filename = 'dsetf.h5' ! 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(HSIZE_T), dimension(2) :: dims = (/4,6/) ! Dataset dimensions
  integer :: rank = 2 ! Dataset rank

  integer :: error ! Error flag

  call h5open_f(error) ! Initialize FORTRAN interface.
  call h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) ! Create new file, define file id
  call h5screate_simple_f(rank, dims, dspace_id, error) ! Create dataspace
  call h5dcreate_f(file_id, dsetname, H5T_NATIVE_INTEGER, dspace_id, dset_id, error)! Create dataset
  ! Could write to dataset here if we wanted
  call h5dclose_f(dset_id, error) ! Close dataset
  call h5sclose_f(dspace_id, error) ! Close dataspace
  call h5fclose_f(file_id, error) ! Close file.
  call h5close_f(error)! Close Fortran interface

end program hdf5_test
