next up previous contents index
Next: Using subdirectories Up: Memory Management and Previous: Proposed HBOOK file

RZ directories and HBOOK files

         

Another advantage of the use of ZEBRA in HBOOK is that ZEBRA's direct access RZ package is available. The RZ package allows data structures to   be uniquely addressed via pathnames, which are based on Unix file names. Related data structures are addressed from a directory.

Routine HROPEN issues a the Fortran OPEN statement and declares the RZ top directory.

Example of using HROPEN

      CALL HROPEN(LUN,'HISTO1','HISTOS.DAT',CHOPT,LRECL,ISTAT)

In this example, HROPEN issues a Fortran direct-access open statement for the file HISTOS.DAT. If, on input, LRECL contains the value 0, HROPEN will automatically determine the record length of the file, provided that the file already exists.

Each time a RZ file is opened via a   call to HROPEN or HRFILE, a supplementary top directory is created with a name specified in the calling sequence. This means that the user can more easily keep track of his data and also the same histogram identifiers can be used in various files, what makes life easier if one wants to study various data samples with the same program, since they can be addressed by changing to the relevant file by a call to HCDIR first. For more information on the RZ package, see the ZEBRA RZ manual.

In the case of the second call to HROPEN, where update mode is requested, it is the users responsibility to ensure that write-acess is enabled, i.e.   the file is not on a read-only mini-disk (VM/CMS systems), or is opened with the SHARED attribute (VAX/VMS systems) etc.    

A Fortran CLOSE statement is also required for each file after calling HREND. Further details of HBOOK's usage of ZEBRA RZ files are given below.

Defining HBOOK files

 CALL HROPEN(1,'HISTO1','HISTO1.DAT',' ',1024,ISTAT)    ! Open first  HBOOK RZ file (read only)
 CALL HROPEN(2,'HISTO2','HISTO2.DAT','U',1024,ISTAT)    ! Open second HBOOK RZ file (update)
 CALL HCDIR('//HISTO1',' ')                             ! Make HISTO1 current directory
 CALL HRIN(20,9999,0)                                   ! Read ID 20 on file 1
   ....
 CALL HCDIR('//HISTO2',' ')                             ! Make HISTO2 current directory
 CALL HRIN(10,9999,0)                                   ! Read ID 10 on file 2
   ....
 CALL HROUT(20,ICYCLE,' ')                              ! Write ID 20 to file 2
 CALL HREND('HISTO1')                                   ! Close file 1
 CALL HREND('HISTO2')                                   ! Close file 2

In the previous example (and also in figures gif and gif) it is shown how an external file is available via a directory name inside HBOOK (and PAW), and that one can change from one to the other file by merely changing directory, with HBOOK routine HCDIR



next up previous contents index
Next: Using subdirectories Up: Memory Management and Previous: Proposed HBOOK file

Last update: Tue May 16 09:09:27 METDST 1995