Input parameter description:
Output parameter description:
When one is working with many different directories, and has to
refer frequently the same directory, then the latter can be defined
as the naming directory, designated by the symbol
'~
'
in pathnames.
A typical example would be an application where subdirectories have
to be created in user routines in which the complete pathname of the
naming directory is unknown.
To set the naming directory a call to RZNDIR must be made.
Input parameter description:
Output parameter description:
The CWD is set to the top directory after a call to RZMAKE. The CWD can be changed, displayed or obtained by a call to RZCDIR.
All operations of RZ routines manipulating keys (i.e. RZIN, RZOUT, RZRDIR, RZKEYS, RZPURG, RZDELK, RZDELT, RZQUOT, RZPASS) refer to objects in the ``Current Working Directory'' or CWD for short.
It is not necessary to specify //Top_dir in a pathname unless several RZ files are open simultaneously. If only one RZ file is declared, the following two calls are equivalent:
CALL RZCDIR('//top_dir/dira/dirb/dirc',' ') and CALL RZCDIR('/dira/dirb/dirc',' ')
If the CWD was already set to /dira/dirb one can further abbreviate the calling sequence to
CALL RZCDIR('dirc',' ')
To go one level up in the directory tree one can use ' ', e.g. if the CWD is /dira/dirb/dirc then the two following calls are equivalent:
CALL RZCDIR('\',' ') and CALL RZCDIR('/dira/dirb',' ')
To set the CWD to the Naming directory one uses:
CALL RZCDIR('~',' ')
CALL RZMDIR (CHDIR,NWKEY,CHFORM,CHTAG)
/, \ ,* ,~ or ?
are allowed in a directory name.
A directory below the current ``working directory'' (see RZCDIR) can be created by a call to RZMDIR.
To create a geometry file for the OPAL detector the data base for the experiment has as top directory called //OPAL. A directory called Geometry is created, which will contain the names of the 12 main detectors of OPAL.
CHARACTER TAGS(2)*8 INTEGER KEY(2) CALL RZMDIR('Geometry',1,'H','Detector') CALL RZCDIR('Geometry',' ') TAGS(1)='Volume' TAGS(2)='Number' CALL RZMDIR('CDET',2,'HI',TAGS) CALL RZMDIR('ECAL',2,'HI',TAGS) CALL RZMDIR('HCAL',2,'HI',TAGS) CALL RZMDIR('FDET',2,'HI',TAGS) CALL RZMDIR('MUON',2,'HI',TAGS) .......
As we now want to introduce information into the CDET directory, we put our working directory equal to the latter by a call to RZCDIR:
CALL RZCDIR('CDET',' ')
which is equivalent to
CALL RZCDIR('//OPAL/Geometry/CDET'),' ')
Logical records can then be entered corresponding to the parameters of each of the 24 sectors of the Jet chamber of the Central detector, of the vertex detector and of the Z chambers (routine RZOUT is described below).
C-- Write the information for the 24 Jet chamber sectors CALL UCTOH('SECT',KEY,4,4) DO 10 ISECT=1,24 KEY(2)=ISECT CALL RZOUT(IXSTOR,LQ(LCDET-ISECT),KEY,ICYCLE,' ') 10 CONTINUE C-- Write the information for the vertex chamber CALL UCTOH('VERT',KEY,4,4) KEY(2)=1 CALL RZOUT(IXSTOR,LVERT,KEY,ICYCLE,' ') C-- Write the information for the Z chambers CALL UCTOH('ZCHA',KEY,4,4) CALL RZOUT(IXSTOR,LZCHA,KEY,ICYCLE,' ')
Update records for the geometry of each detector can be foreseen, e.g. by creating a directory 'Updates' below 'CDET'
CALL RZMDIR('Updates',1,'I','RUN')
The Logical records in the 'Updates' directory will contain the detector's identification as well as update parameters. KEY(1) could be the RUN number from which the given corrections should be applied. The procedure to build the geometry data structure could be the following:
CALL RZKEYD (NWKEY*,CHFORM*,CHTAG*)
Output parameter description:
Information about the key definitions, as declared by RZMDIR, for the CWD can be obtained be a call to RZKEYD.
When an RZ random access file is declared mode 'SU' (shared/update) with RZFILE , then care must be taken to propagate the changes made to the file to other processes, which are accessing the file concurrently. Therefore, whenever the directory structure or the data part of the CWD has to be changed by calling one of the following routines: RZMDIR, RZCOPY, RZDELT, RZDELK, RZFRFZ, RZOUT, RZPURG, RZQUOT, RZRENK,
then, before using the first time any of these routines, the CWD must be locked by a calling routine RZLOCK. To use this routine the write password must have been specified if one has been defined. Once a directory is locked, all subdirectories become unavailable for locking. Hence when the top directory is locked, the complete file is locked.
Note that two or more branches of a directory can be modified concurrently by different users (each one making a call to RZLOCK), as long as for any given directory to be locked there is no higher level directory already in a locked state.
Once all modifications to a directory are performed, it must be unlocked by a call to RZFREE. This routine outputs the updated directories and provides them with a time stamp, so that other users can determine whether they want to update the copy of the directories they are working with.
Input parameter description:
Routine RZQUOT allows the user to define a space quota for the CWD and all its subdirectories.
Subroutine RZSCAN scans a directory structure from the specified starting directory. For each subdirectory found, the user provided routine UROUT is called as shown below.
Example of using the routine RZSCAN
EXTERNAL UROUT CALL RZSCAN('//CERN/DELPHI',UROUT) END SUBROUTINE UROUT(CHPATH) CHARACTER*(*) CHPATH PRINT *,CHPATH(1:LENOCC(CHPATH)) END
The keys and the subdirectory names belonging to a given pathname can be listed by a call to RZLDIR.
If the keys have been defined by RZMAKE or RZMDIR with format 'H', they are listed each with 4 characters. If keys have been defined with format 'A', they are listed without separators.
CALL RZRDIR (MAXDIR,CHDIR*,NDIR*)
Input parameter description:
Output parameter description:
The list of NDIR directories attached to the CWD is retrieved and stored into the character array CHDIR.
Each directory of an RZ file can have its own write password. When an RZ file is first initialized with RZMAKE there is no write password set. Routine RZPASS can be used to specify or change the password of the CWD.
By default, when a directory is created (RZMDIR), the write password is set equal to the one of the parent directory. If a password is set, a call to RZPASS is necessary to be able to write a new key, create a new directory or delete a key or directory. The password specified using RZPASS is checked against the one encrypted in the RZ directory referenced.
Examples:
CALL RZPASS('password',' ') | specifies a write password |
CALL RZPASS('New,'S') | changes or sets a password |