next up previous contents index
Next: Summary of KERNLIB Up: Technical details of Previous: RZ link area

Structure of the RZ control bank

The variable LTOP points to the control bank for the current RZ file, e.g. the one corresponding to the current working directory.

The first data word of this control bank can be accessed by IQ(KQSP+LTOP+1), where KQSP is the offset of the primary store from LOCF(LQ(0)).

The record numbers for each subdirectory of a given directory are in a separate structure. The subdirectory structure of the top directory is reached by IQ(KQSP+LTOP+KLS).

For the top directory, IQ(KQSP+LTOP+KLB) points to a file descriptor structure,

RZ Directory structure (DZDOC format)

\label{xmp:rztop}
 Bank IDH  RZ       RZ system top bank                                          
 Bank IDN           Numeric bank identifier
                    Fortran Unit
                    If CACCESS set: 1000 + file pointer
                    If HACCESS set: address of user routine
 Author             R.Brun                                                      
 Store     0                                                                    
 Division  SYSTEM                                                               
 NL              10                                                             
 NS               9                                                             
 ND        variable                                                             
 Next      RZ0                                                                  
 Up        NONE                                                                 
 IO-Charac          I                                                           
              ---------- Description of the links  ----------
 1         LSDIR    Pointer to first subdirectory                               
 2         LFREE    Pointer to list of free records                             
 3         LUSED    pointer to list of used records                             
 4         LFROM    Pointer to copied directory                                 
 5         LPURG    Pointer to list of purged records                           
 6         LROUT    Pointer to output buffer                                    
 7         LRIN     Pointer to input buffer                                     
 8         LCORD    Pointer to ordered cycles (RZCOPY)                          
 9         LSNUSED  Free                                                        
              ---------- Description of the Reference links  ----------
 1         LRNUSED  Free reference link *                                       
              ---------- Description of the status bits ----------
 1         NOAUTH   no authorisation to modify directory                        
 2         MODIFIED directory has been modified                                 
 3         LOCKED   file locked by 'RZFILE'                                     
 4         ORGREL   ORGANIZATION='RELATIVE' on VAX                              
 5         CACCESS  C file access routine used                                  
 6         HACCESS  Hook to user's I/O routine
 7-13      USERLUN  User unit number
 14                 Reserved for future use
 15-17     LOGLEVEL LOG-level+3  (default taken from MZ)                     
              ---------- Description of the data words   ----------
 1         Z:IDNAME Directory name (up to 16 characters)                        
 2         Z:IDNAME "                                                           
 3         Z:IDNAME "                                                           
 4         Z:IDNAME "                                                           
 5         RECPT1   Record number of the mother directory,                      
 6         RECPT2   or C file pointer (words 5 and 6)                           
 7         B:IWPW1  Write password (1st part)                                   
 8         B:IWPW2  (2nd part)                                                  
 9         NCHDRW   No. of char. DIR(1:5),WPW(6:10), and bit 12 eX mode         
 10        D:IDATEC Creation date/time                                          
 11        D:IDATEM Last mod date/time                                          
 12        NQUOTA   Maximum number of records QUOTA                             
 13        N:NRUSED Number of used records                                      
 14        NWUSED   Number of words used MOD 1000000                            
 15        NMEGA    Number of megawords used                                    
 16        RESERVED Reserved                                                    
 17        IRIN     Record number currently in LRIN                             
 18        IROUT    Record number currently in LROUT                            
 19        IRLOUT   Number of the last record written                           
 20        IP1      Pointer to first free word in IRLOUT                        
 21        ICONT    Record number continuation                                  
 22        NFREE    Number of words free in F                                   
 23        N:NSD    Number of subdirectories                                    
 24        P:LD     Pointer to directory records                                
 25        P:LB     Pointer to file descriptor (only for TOP)                   
 26        P:LS     Pointer to first subdirectory S                             
 27        P:LK     Pointer to first KEY K                                      
 28        P:LF     Pointer to free space F                                     
 29        LC       Pointer to last cycle C                                     
 30        LE       Pointer to end of directory                                 
 31        N:NKEYS  Number of keys in that directory                            
 32        N:NWKEY  Number of elements in one key                               
 --REP level=1  N:NWKEY + 9 / 10                                                
     1       B:KDES   KEYS descriptor (3 bits per el. ,10 keys per word)        
 --REP level=1 -- End --                                                        
 --REP level=1  N:NWKEY                                                         
     1       Z:TAG1   First part of CHTAG(1) 4 characters                       
     2       Z:TAG2   Second part                                               
 --REP level=1 -- End --                                                        
 1         L:LD     Directory records structure                                 
 1         N:NRD    Number of records to describe this dir.                     
 --REP level=1  N:NRD                                                           
     1       IREC(I)  Record number I of directory                              
 --REP level=1 -- End --                                                        
 1         L:LB     file descriptor (only for TOP)                              
 1         N:NWREC  Number of words for bitmap descriptor                       
 2         LREC     Physical record length (in words)                           
 3         D:IDATE  Creation date of the file                                   
 --REP level=1  N:NWREC                                                         
     1       B:BITMAP 1 bit per record on the file                              
 --REP level=1 -- End --                                                        
 1         L:LS     Subdirectory structure                                      
 --REP level=1  N:NSD                                                           
     1       Z:NAM1   Name of subdirectory                                      
     2       Z:NAM2   "                                                         
     3       Z:NAM3   "                                                         
     4       Z:NAM4   "                                                         
     5       NCHSD    Number of characters in subdirectory name                 
     6       IRECSD   Record number of this subdirectory                        
     7       D:IDTIME Date and Time of creation of subdirectory                 
 --REP level=1 -- End --                                                        
 1         L:LK     KEYS structure                                              
 --REP level=1  N:NKEYS ! I=1,NKEYS                                             
     1       P:LCYC   Pointer to highest cycle in C for key I                   
   --REP level=2  N:NWKEYS! K=1,NWKEYS                                          
         1     KEYS(I,K Element K of key I                                      
   --REP level=2 -- End --                                                      
 --REP level=1 -- End --                                                        
 1         L:LF     Start of free space                                         
 --REP level=1  NFREE                                                           
     1       EMPTY    Free space                                                
 --REP level=1 -- End --                                                        


For RZ version 0:

 1         L:LCYC   Cycles structure                                            
 1         PTOCYCLE                                                             
 1         P:BI0015 LCYC Pointer to prev cycle of KEY (0 if no)                 
 1         P:BI1631 SECREC Second record (if there) (bits 17 to 32)             
 2         D:CREATD Creation date/time relative to 1986 (bits 9 TO 32)          
 2         BITVAL04 RZKEEP (bit 5)                                              
 2         BITVAL03 Append mode (bit 4)                                         
 2         BITS0002 Vector format (if RZVOUT) (bits 1 to 3)                     
 3         PTODATA  Pointer to the data                                         
 3         BITS1631 Record number where data str. starts (bits 17 to 32)        
 3         BITS0015 Offset in record (bits 1 to 16)                             
 4         CYWORD4                                                              
 4         BITS0019 Number of words in data structure (bits 1 to 20)            
 4         BITS2031 Cycle number (bits 21 to 32)                                


For RZ version 1:


 1         L:LCYC   Cycles structure                                            
 1         PTOCYCLE LCYC Pointer to prev cycle of KEY (0 if no)                 
 2         D:CREATD Creation date/time relative to 1986 (bits 9 TO 32)          
 2         BITVAL04 RZKEEP (bit 5)                                              
 2         BITVAL03 Append mode (bit 4)                                         
 2         BITS0002 Vector format (if RZVOUT) (bits 1 to 3)                     
 3         PTODATA  Pointer to the data                                         
 3         PTODATA  Record number where data str. starts 
 4         OFFSET   (20 bits gives a long record!)
 4         BITS0015 Offset in record (bits 1 to 20)                             
 4         BITS2031 Cycle number (bits 21 to 32)                                
 5         NUMWORD  Number of words in data structure
 6         PTODATA  Pointer to the data                                         
 6         PTODATA  continuation record number
 7         KEYNUMB  Key number to which the cycle belongs

Subdirectory descriptor structure

The subdirectories below a given directory are described by the part labelled LS in the description of the top bank. To loop over all subdirectories at a given level, the following code could be used.

Looping over all subdirectories at a given level

*
*     Loop over all subdirectories at this level
*
         DO 5 JJ=1,IQ(KQSP+LCDIR+KNSD)
            LS=IQ(KQSP+LCDIR+KLS)
            IH=LS+7*(JJ-1)
            CALL ZITOH(IQ(KQSP+LCDIR+IH),IHDIR,4)
            CALL UHTOC(IHDIR,4,CHDIR,16)
*
*     CHDIR now contains the name of subdirectory JJ in
*     CHARACTER format
*
...
   5        CONTINUE

KEYS structure

For a given directory, the keys structure is given by the part labelled LK in the description of the top bank. The following Fortran code could be used to process the keys in a given subdirectory.

Processing the RZ keys

      NWK        = IQ(KQSP+LCDIR+KNWKEY)
      NKEYS      = IQ(KQSP+LCDIR+KNKEYS)
      LK         = IQ(KQSP+LCDIR+KLK)
      DO 50 I=1,NKEYS
*           Number of this key vector
         K=LK+(NWK+1)*(I-1)
         DO 40 J=1,NWK
            IKDES=(J-1)/10
            IKBIT1=3*J-30*IKDES-2
            IF(JBYT(IQ(KQSP+LCDIR+KKDES+IKDES),IKBIT1,3).LT.3)THEN
               KEYS(J)=IQ(KQSP+LCDIR+K+J)
            ELSE
               CALL ZITOH(IQ(KQSP+LCDIR+K+J),KEYS(J),1)
            ENDIF
  40     CONTINUE
*         Here we have KEY vector # I in KEYS()
      ...
  50  CONTINUE

CYCLES structure

The cycles structure is given by the part labelled LCYC in the description of the top bank.

File descriptor structure

The file descriptor can be found in the part labelled LB in the description of the top bank.

Lock record

The record lock information is encoded in the part labelled LC in the description of the top bank.


Janne Saarela
Mon May 15 08:34:47 METDST 1995