Merge files to single file

i have a plan to implement that files with same datatype( mixed … int , double , array ) merge to single file using H5DOwrite_chunk and H5DOread_chunk.
all files have same structure ( one dataset )…
is there a built-in function for that ?
there are a lot of built-in function example… but i think no exist for merge function using H5DO functions…

my testing code following…
not working…
can anyone comment about this?
thanks…


test_copy_append()
{
typedef struct _datetype
{
int year;
int month;
int day;
} _datetype;

typedef struct dtype
{
int a1;
int a2;
_datetype a3;
__int64 a4;
double a5;
double a6[10];

} dtype;

unsigned filter_mask1 = 0, filter_mask2 = 0;
hid_t file_id, dataset_id, mem_tid, dxpl1;
hid_t dspace_id, dtype_id, plist_id;
herr_t status;
hsize_t offset[2] = { 0, 0 };
int ret;

int size = sizeof(dtype);
size_t chunk_size = 100 * size;
dtype* dset_data = HDmalloc(chunk_size);
dtype* dset_data2 = HDmalloc(chunk_size);
hsize_t read_buf_size = 0;
uLongf z_dst_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(chunk_size);

dxpl1 = H5Pcreate(H5P_DATASET_XFER);

/* Open an existing dataset. */
file_id = H5Fopen(“test0.h5”, H5F_ACC_RDWR, H5P_DEFAULT);
dataset_id = H5Dopen2(file_id, “/dataset1”, H5P_DEFAULT);

dspace_id = H5Dget_space(dataset_id);
dtype_id = H5Dget_type(dataset_id);
mem_tid = H5Tget_native_type(dtype_id, H5T_DIR_DEFAULT);
plist_id = H5Dget_create_plist(dataset_id);

status = H5Dget_chunk_storage_size(dataset_id, offset, &read_buf_size);

status = H5DOread_chunk(dataset_id, dxpl1, offset, &filter_mask1, dset_data);

/* Perform decompression from the source to the destination buffer */
//ret = uncompress(dset_data2, &z_dst_nbytes, dset_data, chunk_size);
z_dst_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(read_buf_size);
ret = uncompress(dset_data2, &z_dst_nbytes, dset_data, read_buf_size);

/* Check for various zlib errors */
if (Z_BUF_ERROR == ret) {
HDfprintf(stderr, “overflow\n”);
}
else if (Z_MEM_ERROR == ret) {
HDfprintf(stderr, “deflate memory error\n”);
}
else if (Z_DATA_ERROR == ret) {
HDfprintf(stderr, “corrupted data\n”);
}
else if (Z_OK != ret) {
HDfprintf(stderr, “other deflate error\n”);
}

status = H5Dclose(dataset_id);
}