next up previous
Next: ACCESSING OBJECTS BY MAPPING
Up: HDS Hierarchical Data System
Previous: CREATING OBJECTS

WRITING AND READING OBJECTS  

Having created our structure we now want to put some values into it. This can be done by using the DAT_PUT and DAT_PUTC routines. For example, to fill the main data array in the above example with values we might do the following:

      ...
      BYTE IMVALS( 512, 1024 )
      CHARACTER * ( DAT__SZLOC ) LOC

*  Put data from array IMVALS to the object DATA_ARRAY.
      CALL DAT_FIND( NLOC, 'DATA_ARRAY', LOC, STATUS )
      CALL DAT_PUT( LOC, '_UBYTE', 2, DIMS, IMVALS, STATUS )
      CALL DAT_ANNUL( LOC, STATUS )

*  Put data from character constant to the object LABEL.
      CALL DAT_FIND( NLOC, 'LABEL', LOC, STATUS )
      CALL DAT_PUTC( LOC, 0, 0, 'This is the data label', STATUS )
      CALL DAT_ANNUL( LOC, STATUS )
      ...

Because this sort of activity occurs quite often, "packaged" access routines have been developed and are available to the programmer (see Appendix [*]). A complementary set of routines also exists for getting data from objects back into program arrays or variables; these are the DAT_GET routines. Again, packaged versions exist and are often handy in reducing the number of subroutine calls required.



next up previous
Next: ACCESSING OBJECTS BY MAPPING
Up: HDS Hierarchical Data System
Previous: CREATING OBJECTS

HDS Hierarchical Data System
Starlink User Note 92
R.F. Warren-Smith & M.D. Lawden
23rd February 1999
E-mail:rfws@star.rl.ac.uk

Copyright (C) 1999 Central Laboratory of the Research Councils