# Filling compund data types in Fortran

**URL:** <https://forum.hdfgroup.org/t/filling-compund-data-types-in-fortran/2445>\
**Category:** Hdf-forum archives\
**Created:** [January 25, 2012, 2:08pm UTC](https://forum.hdfgroup.org/t/filling-compund-data-types-in-fortran/2445 "2012-01-25T14:08:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rod\_Cook](https://forum.hdfgroup.org/letter_avatar_proxy/v4/letter/r/e274bd/32.png) [@Rod\_Cook](https://forum.hdfgroup.org/u/Rod_Cook)\
**Post date:** [January 25, 2012, 2:08pm UTC](https://forum.hdfgroup.org/t/filling-compund-data-types-in-fortran/2445/1 "2012-01-25T14:08:31Z")

</div>

How do I fill a dataset containing a compound type in Fortran? For example

TYPE MYTYPE  
&nbsp;&nbsp;&nbsp;INTEGER ,DIMENSION(100) :: INTS  
&nbsp;&nbsp;&nbsp;CHARACTER(LEN=1000) :: STR  
END TYPE

The H5Pset\_fill\_value\_f routine seems to be overloaded for integer, real and character. Calling it with an integer fill value sets all the INTS(1) in the dataset to this value, everything else is junk.

Thanks

Rod Cook

---

<div class="post-metadata">

**Author:** ![Rod\_Cook](https://forum.hdfgroup.org/letter_avatar_proxy/v4/letter/r/e274bd/32.png) [@Rod\_Cook](https://forum.hdfgroup.org/u/Rod_Cook)\
**Post date:** [January 25, 2012, 4:42pm UTC](https://forum.hdfgroup.org/t/filling-compund-data-types-in-fortran/2445/2 "2012-01-25T16:42:24Z")

</div>

I've just realised that you have to do the fill field at a time. Sorry for wasting anybody's time.

Rod Cook

> **···**
>
> On 25/01/2012 14:08, Rod Cook wrote:
> 
> > How do I fill a dataset containing a compound type in Fortran? For example
> > 
> > TYPE MYTYPE  
> > &nbsp;&nbsp;INTEGER ,DIMENSION(100) :: INTS  
> > &nbsp;&nbsp;CHARACTER(LEN=1000) :: STR  
> > END TYPE
> > 
> > The H5Pset\_fill\_value\_f routine seems to be overloaded for integer, real and character. Calling it with an integer fill value sets all the INTS(1) in the dataset to this value, everything else is junk.
> > 
> > Thanks
> > 
> > Rod Cook
> > 
> > \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> > Hdf-forum is for HDF software users discussion.  
> > Hdf-forum@hdfgroup.org  
> > [http://mail.hdfgroup.org/mailman/listinfo/hdf-forum\_hdfgroup.org](http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org)

---

<div class="post-metadata">

**Author:** ![brtnfld](https://forum.hdfgroup.org/user_avatar/forum.hdfgroup.org/brtnfld/32/1444_2.png) [@brtnfld](https://forum.hdfgroup.org/u/brtnfld)\
**Post date:** [January 25, 2012, 6:35pm UTC](https://forum.hdfgroup.org/t/filling-compund-data-types-in-fortran/2445/3 "2012-01-25T18:35:57Z")

</div>

In release 1.8.8 (build with --enable-fortran2003) you can pass the compound datatype type\_id directly. An example how to do this is in "SUBROUTINE test\_create" in fortran/test/tH5P\_F03.f90 of the hdf5 source.

> **···**
>
> On 25.01.2012 11:42, Rod Cook wrote:
> 
> > I've just realised that you have to do the fill field at a time.  
> > Sorry for wasting anybody's time.
> > 
> > Rod Cook
> > 
> > On 25/01/2012 14:08, Rod Cook wrote:
> > 
> > > How do I fill a dataset containing a compound type in Fortran? For example
> > > 
> > > TYPE MYTYPE  
> > > &nbsp;&nbsp;INTEGER ,DIMENSION(100) :: INTS  
> > > &nbsp;&nbsp;CHARACTER(LEN=1000) :: STR  
> > > END TYPE
> > > 
> > > The H5Pset\_fill\_value\_f routine seems to be overloaded for integer, real and character. Calling it with an integer fill value sets all the INTS(1) in the dataset to this value, everything else is junk.
> > > 
> > > Thanks
> > > 
> > > Rod Cook
> > > 
> > > \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> > > Hdf-forum is for HDF software users discussion.  
> > > Hdf-forum@hdfgroup.org  
> > > [http://mail.hdfgroup.org/mailman/listinfo/hdf-forum\_hdfgroup.org](http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org)
> > 
> > \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> > Hdf-forum is for HDF software users discussion.  
> > Hdf-forum@hdfgroup.org  
> > [http://mail.hdfgroup.org/mailman/listinfo/hdf-forum\_hdfgroup.org](http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org)
