vd_ex3f.f



      PROGRAM vd_ex3f 
 
      implicit none

C     Write single field order 3 vdata

      integer*4 file_id, vdata_id, number_of_rows
      integer i, istat
      integer*4 vdata_buf(30)
      integer hopen, vsfatch, vsffdef, vsfsfld
      integer vsfwrit, vsfsnam, vsfscls, vsfdtch
      integer hclose, vfstart, vfend

C     DFACC_CREATE, DFNT_INT32 and FULL_INTERLACE are defined 
C     in hdf.inc.
      integer*4 DFACC_CREATE, DFNT_INT32, FULL_INTERLACE
      parameter (DFACC_CREATE = 4,
     +           DFNT_INT32 = 24,
     +           FULL_INTERLACE = 0)

      character field_name *13
      parameter (field_name = 'Field Entries')
      parameter (number_of_rows = 10)

C     Create an HDF file with full access. 
      file_id = hopen('VD_Ex3f.hdf', DFACC_CREATE, 0)

C     Initialize HDF for subsequent Vgroup/Vdata access. 
      istat = vfstart(file_id)

C     Create a new Vdata. 
      vdata_id = vsfatch(file_id, -1, 'w')

C     Define the field data name, type and order. 
      istat = vsffdef(vdata_id, field_name, DFNT_INT32, 3)

C     Specify the field(s) that will be written to. 
      istat =  vsfsfld(vdata_id, field_name)

C     Generate the Vset data. 
      do 10 i = 1, number_of_rows*3, 3
        vdata_buf(i) = i + 0
        vdata_buf(i + 1) = i + 1
        vdata_buf(i + 2) = i + 2
10    continue

C     Write the data to the Vset. 
      istat = vsfwrit(vdata_id, vdata_buf, number_of_rows , 
     +                FULL_INTERLACE)

C     Set the name and class. 
      istat = vsfsnam(vdata_id, 'Example Vdata')
      istat = vsfscls(vdata_id, 'Example Vdata')

C     Terminate access to the Vdata. 
      istat = vsfdtch(vdata_id)

C     Terminate access to the Vset interface and close the file. 
      istat = vfend(file_id)
      istat = hclose(file_id)

      end