           PROGRAM vlf

           USE HDF5

           IMPLICIT NONE

           ! User defined type
           TYPE Int1DRagArray
           INTEGER :: Num
           INTEGER, DIMENSION(:), POINTER :: Int1D => NULL()
           END TYPE Int1DRagArray

           CHARACTER(LEN=10), PARAMETER :: filename = "vlf.h5" !  File name
           CHARACTER(LEN=5), PARAMETER :: dsetname = "VLint"     !  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) :: vltype_id     ! Datatype identifier


           INTEGER(HSIZE_T), DIMENSION(1) :: dims = (/6/) ! Dataset dimensions
           INTEGER(SIZE_T), DIMENSION(6) :: len           ! Elements lengths
           INTEGER(SIZE_T), DIMENSION(6) :: len_out
           INTEGER     ::   rank = 1                      ! Dataset rank

           INTEGER, DIMENSION(5,6) :: vl_int_data ! Data buffers
           INTEGER, DIMENSION(5,6) :: vl_int_data_out ! Data buffers
           INTEGER     ::   error ! Error flag

           INTEGER     :: i, j    !general purpose integers
           INTEGER(HSIZE_T), DIMENSION(2) :: data_dims = (/5,6/)
           INTEGER(SIZE_T)  max_len

           ! Initialize Fortran interface
           CALL h5open_f (error)

           ! Initialize the vl_int_data array.
           do i = 1, 6
              do j = 1, 5
                 vl_int_data(j,i) = -100
              end do
           end do

           do i = 2, 6
              do j = 1,  i-1
                 vl_int_data(j,i) = i-1
              end do
           end do

           do i = 1,6
               len(i) = i-1
           end do

           ! Create a new file using default properties.
           CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error)

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

           ! Create the dataset with default properties.
           CALL h5tvlen_create_f(H5T_NATIVE_INTEGER, vltype_id, error)

           CALL h5dcreate_f(file_id, dsetname, vltype_id, dspace_id, &
                            dset_id, error)

           ! Write the dataset.
           CALL h5dwrite_vl_f(dset_id, vltype_id, vl_int_data, data_dims, len, error)

           ! End access to the dataset and release resources used by it.
           CALL h5dclose_f(dset_id, error)
           CALL h5sclose_f(dspace_id, error)

           ! Close the file.
           CALL h5fclose_f(file_id, error)

           ! Close FORTRAN interface
           CALL h5close_f (error)

           END PROGRAM vlf 

