| 
     
     
         
 
 
  
 
  
 
  
 
  
 
  
 
  
 
          | 
     
     
         | 
          
          
          
          Updated: 
          
11 December 1998
          
          
          
          | 
      
 
 
Guide to OpenVMS File Applications
10.1.3 Using Interactive Mode
The /INTERACTIVE qualifier begins an interactive session in which you 
can examine the structure of an RMS file.
ANALYZE/RMS_FILE imposes a hierarchical tree structure on the internal 
RMS
file structure. Each data structure in the file is a node, with a 
branch for each pointer in the data structure. The file header is 
always the root node. Each of the three file organizations (sequential, 
relative, and indexed) has its own tree structure.
To examine a file, you enter commands that move the current position to 
particular structures within the tree. The utility displays the current 
structure on the screen.
Table 10-1 summarizes the ANALYZE/RMS_FILE commands.
  Table 10-1 ANALYZE/RMS_FILE Command Summary
  
    | Command  | 
    Function  | 
  
  
    | 
      AGAIN
     | 
    
      Displays the current structure again.
     | 
  
  
    | 
      DOWN [branch]
     | 
    
      Moves the structure pointer down to the next level. If the current node 
      has more than one branch, the branch keyword must be specified.
        If a branch keyword is required but not specified, the utility will 
      display a list of possibilities to prompt you. You can also display the 
      list by specifying "DOWN ?."
      | 
  
  
    | 
      DUMP n
     | 
    
      Displays a hexadecimal dump of the specified block.
     | 
  
  
    | 
      EXIT
     | 
    
      Ends the interactive session.
     | 
  
  
    | 
      FIRST
     | 
    
      Moves the structure pointer to the first structure on the current 
      level. The structure is displayed. For example, if you are examining 
      data buckets and want to examine the first bucket, this command will 
      put you there and display the first bucket's header.
     | 
  
  
    | 
      HELP [keyword ...]
     | 
    
      Displays help messages about the interactive commands.
     | 
  
  
    | 
      NEXT
     | 
    
      Moves the structure pointer to the next structure on the current level. 
      The structure is displayed.
      
      
                 Pressing the Return key is equivalent to a NEXT command.
      | 
  
  
    | 
      REST
     | 
    
      Moves the structure pointer along the rest of the structures on the 
      current level, and each is displayed in turn.
     | 
  
  
    | 
      TOP
     | 
    
      Moves the structure pointer up to the file header. The file header is 
      displayed.
     | 
  
  
    | 
      UP
     | 
    
      Moves the structure pointer up to the next level. The structure at that 
      level is displayed.
     | 
  
10.1.4 Examining a Sequential File
Figure 10-1 shows the tree structure of a sequential file.
Figure 10-1 Tree Structure for Sequential Files
The FILE HEADER structure is always the first structure displayed. From 
the FILE HEADER structure, the DOWN command moves the current position 
to the FILE ATTRIBUTES structure. The DOWN command from the FILE 
ATTRIBUTES structure moves the current position to the first record in 
the file. From the first record, the REST command will move the current 
position through the records in the file, displaying each one in turn. 
A series of NEXT commands will also accomplish this same operation.
Figure 10-2 shows the layout and contents of the records in a 
sequential file SEQ.DAT. Example 10-3 is an interactive examination of 
SEQ.DAT, showing the contents of three records in the file.
Figure 10-2 Record Layout and Content for SEQ.DAT
  
    | Example 10-3 Examining a Sequential File | 
  
  
    
       
      
$ ANALYZE/RMS_FILE/INTERACTIVE SEQ.DAT
 
 | 
  
    
       
      
FILE HEADER 
       File Spec: DISK$DELPHIWORK:[RMS32]SEQ.DAT;3 
       File ID: (1170,2,2) 
       Owner UIC: [730,465] 
       Protection:  System: RWED, Owner: RWED, Group: RWED, World: 
       Creation Date:    7-MAY-1993 16:51:30.92 
       Revision Date:    8-MAY-1993 14:02:17.15, Number: 3 
       Expiration Date: none specified 
       Backup Date:     none posted 
       Contiguity Options:  none 
       Performance Options: none 
       Reliability Options: none 
 | 
  
    
       
      
RMS FILE ATTRIBUTES 
       File Organization: sequential 
       Record Format: variable 
       Record Attributes:   carriage-return 
       Maximum Record Size: 0 
       Longest Record: 73 
       Blocks Allocated: 3, Default Extend Size: 0 
       End-of-File VBN: 1, Offset: %X'00E4' 
       File Monitoring: disabled 
       Global Buffer Count: 0 
 | 
  
    
       
      
       DATA BYTES (VBN 1, offset %X'0000'): 
                       7  6  5  4  3  2  1  0          01234567 
                     ------------------------          -------- 
                      31 30 30 30 30 30 00 49|  0000  |I.000001| 
                      20 4C 41 54 49 47 49 44|  0008  |DIGITAL | 
                      4E 45 4D 50 49 55 51 45|  0010  |EQUIPMEN| 
                      52 4F 50 52 4F 43 20 54|  0018  |T CORPOR| 
                      31 31 20 4E 4F 49 54 41|  0020  |ATION 11| 
                      42 20 54 49 50 53 20 30|  0028  |0 SPIT B| 
                      41 4F 52 20 4B 4F 4F 52|  0030  |ROOK ROA| 
                      41 55 48 53 41 4E 20 44|  0038  |D NASHUA| 
                      33 30 48 4E 20 20 20 20|  0040  |    NH03| 
                                  00 31 36 30|  0048  |062.    | 
 | 
  
    
       
      
       DATA BYTES (VBN 1, offset %X'004C'): 
                       7  6  5  4  3  2  1  0          01234567 
                     ------------------------          -------- 
                      32 30 30 30 30 30 00 49|  0000  |I.000002| 
                      49 46 46 4F 20 42 44 41|  0008  |ADB OFFI| 
                      4C 50 50 55 53 20 45 43|  0010  |CE SUPPL| 
                      20 20 20 20 20 53 45 49|  0018  |IES     | 
                      32 34 20 20 20 20 20 20|  0020  |      42| 
                      4F 4D 45 53 4F 52 20 30|  0028  |0 ROSEMO| 
                      45 52 54 53 20 54 4E 55|  0030  |UNT STRE| 
                      49 44 20 4E 41 53 54 45|  0038  |ETSAN DI| 
                      32 39 41 43 20 4F 47 45|  0040  |EGO CA92| 
                                  00 30 31 31|  0048  |110.    | 
 | 
  
    
       
      
       DATA BYTES (VBN 1, offset %X'0098'): 
                       7  6  5  4  3  2  1  0          01234567 
                     ------------------------          -------- 
                      33 30 30 30 30 30 00 49|  0000  |I.000003| 
                      52 50 20 52 4F 4C 4F 43|  0008  |COLOR PR| 
                      4C 20 47 4E 49 54 4E 49|  0010  |INTING L| 
                      52 4F 54 41 52 4F 42 41|  0018  |ABORATOR| 
                      34 39 20 20 20 53 45 49|  0020  |IES   94| 
                      35 20 54 53 41 45 20 39|  0028  |9 EAST 5| 
                      45 45 52 54 53 20 48 54|  0030  |TH STREE| 
                      4F 59 20 57 45 4E 20 54|  0038  |T NEW YO| 
                      30 31 59 4E 20 20 4B 52|  0040  |RK  NY10| 
                                  00 33 30 30|  0048  |003.    | 
 | 
10.1.5 Examining a Relative File
Figure 10-3 shows the tree structure of relative files.
Figure 10-3 Tree Structure of Relative Files
The tree structure of relative files also begins with the FILE HEADER 
and FILE ATTRIBUTES structures. From the FILE ATTRIBUTES structure, the 
next structure down is the PROLOG. The first structure down from the 
PROLOG is the FIRST DATA BUCKET. The data bucket structures can be 
examined with the REST command or one at a time with the NEXT command. 
The only information at the data bucket level is the number of the data 
bucket's virtual block.
The next structure down is the FIRST RECORD CELL IN FIRST BUCKET. You 
can examine the records in each cell by specifying either the REST 
command or a series of NEXT commands.
Example 10-4 shows an interactive examination of a relative file.
  
    | Example 10-4 Examining a Relative File | 
  
  
    
       
      
FILE HEADER 
       File Spec: DISK$NEWWORK:[RMS32]REL.DAT;1 
       File ID: (9573,7,2) 
       Owner UIC: [181,065] 
       Protection:  System: RWED, Owner: RWED, Group: RE, World: 
       Creation Date:   22-MAY-1993 10:42:04.95 
       Revision Date:   22-MAY-1993 10:42:05.81, Number: 1 
       Expiration Date: none specified 
       Backup Date:     none posted 
       Contiguity Options:  contiguous-best-try 
       Performance Options: none 
       Reliability Options: none 
 | 
  
    
       
      
RMS FILE ATTRIBUTES 
       File Organization: relative 
       Record Format: variable 
       Record Attributes:   carriage-return 
       Maximum Record Size: 75 
       Blocks Allocated: 9, Default Extend Size: 0 
       Bucket Size: 3 
       File Monitoring: disabled 
       Global Buffer Count: 0 
 | 
  
    
       
      
FIXED PROLOG 
       Prolog Flags: 
              (0)  PLG$V_NOEXTEND   0 
       First Data Bucket VBN: 2 
       Maximum Record Number: 2147483647 
       End-of-File VBN: 10 
       Prolog Version: 1 
 | 
  
    
       
      
       RECORD CELL (VBN 2, offset %X'0000'): 
              Cell Control Flags: 
                     (2)  DLC$V_DELETED    0 
                     (3)  DCL$V_REC        1 
              Record Bytes: 
                       7  6  5  4  3  2  1  0          01234567 
                     ------------------------          -------- 
                      31 30 30 30 30 30 00 49|  0000  |I.000001| 
                      20 4C 41 54 49 47 49 44|  0008  |DIGITAL | 
                      4E 45 4D 50 49 55 51 45|  0010  |EQUIPMEN| 
                      52 4F 50 52 4F 43 20 54|  0018  |T CORPOR| 
                      31 31 20 4E 4F 49 54 41|  0020  |ATION 11| 
                      42 20 54 49 50 53 20 30|  0028  |0 SPIT B| 
                      41 4F 52 20 4B 4F 4F 52|  0030  |ROOK ROA| 
                      41 55 48 53 41 4E 20 44|  0038  |D NASHUA| 
                      33 30 48 4E 20 20 20 20|  0040  |    NH03| 
                                     31 36 30|  0048  |062     | 
 | 
If you use the REST command at the CELL AND RECORD level, the utility 
will display all the cells and records in the file, not just the cells 
and records in the current bucket.
10.1.6 Examining an Indexed File
The structure of an indexed file also begins with the FILE HEADER, FILE 
ATTRIBUTES, and PROLOG structures. From the PROLOG structure, the file 
structure branches to the area descriptors and the key descriptors. To 
branch to the area descriptor path, specify the command DOWN AREA. To 
branch to the key descriptor path, specify DOWN KEY.
The area descriptor path contains structures that show information 
about the various areas in the file. The key descriptor path contains 
the primary key structures (and data records) and any secondary key 
structures.
Figure 10-4 shows the structure following the area descriptor path.
Figure 10-4 Area Descriptor Path
Example 10-5 shows an examination of an area descriptor path from the 
PROLOG level.
  
    | Example 10-5 Examining an Area Descriptor 
    Path | 
  
  
    
       
      
AREA DESCRIPTOR #0 (VBN 3, offset %X'0000')) 
       Bucket Size: 1) 
       Alignment: AREA$C_NONE) 
       Alignment Flags:) 
              (0)  AREA$V_HARD      0) 
              (1)  AREA$V_ONC       0) 
              (5)  AREA$V_CBT       0) 
              (7)  AREA$V_CTG       0) 
       Current Extent Start: 1, Blocks: 9, Used: 7, Next: 8) 
       Default Extend Quantity: 0) 
 | 
Figure 10-5 shows the structure following the key descriptor path. As 
shown in the figure, you can branch directly to the DATA BUCKET, or you 
can branch to the INDEX ROOT BUCKET to begin examination of the index 
structure, eventually reaching the DATA BUCKET structure.
Depending on whether you are examining the primary index structure or 
one of the alternate index structures, there is a difference in the 
contents of the record structure.
The PRIMARY RECORD structure contains the actual data records; the 
ALTERNATE RECORD structures contain secondary index data records 
(SIDRs).
Figure 10-5 Key Descriptor Path
Figure 10-6 displays the structure of the primary records.
Figure 10-6 Structure of Primary Records
As shown in Figure 10-6, the branch from the primary record structure 
allows you to either examine the actual bytes of data within the record 
or to follow the RRV.
Example 10-6 shows an examination of a primary record.
  
    | Example 10-6 Examining a Primary Record | 
  
  
    
       
      
       PRIMARY DATA RECORD (VBN 4, offset %X'000E') 
       Record Control Flags: 
              (2)  IRC$V_DELETED    0 
              (3)  IRC$V_RRV        0 
              (4)  IRC$V_NOPTRSZ    0 
       Record ID: 1 
       RRV ID: 1, 4-Byte Bucket Pointer: 4 
       Key: 
                7  6  5  4  3  2  1  0          01234567 
              ------------------------          -------- 
                     31 30 30 30 30 30|  0000  |000001  | 
 | 
  
    
       
      
         7  6  5  4  3  2  1  0          01234567 
       ------------------------          -------- 
        31 30 30 30 30 30 00 49|  0000  |I.000001| 
        20 4C 41 54 49 47 49 44|  0008  |DIGITAL | 
        4E 45 4D 50 49 55 51 45|  0010  |EQUIPMEN| 
        52 4F 50 52 4F 43 20 54|  0018  |T CORPOR| 
        31 31 20 4E 4F 49 54 41|  0020  |ATION 11| 
        42 20 54 49 50 53 20 30|  0028  |0 SPIT B| 
        41 4F 52 20 4B 4F 4F 52|  0030  |ROOK ROA| 
        41 55 48 53 41 4E 20 44|  0038  |D NASHUA| 
        33 30 48 4E 20 20 20 20|  0040  |    NH03| 
                       31 36 30|  0048  |062     | 
 | 
  
    
       
      
       PRIMARY DATA RECORD (VBN 4, offset %X'000E') 
              Record Control Flags: 
                     (2)  IRC$V_DELETED    0 
                     (3)  IRC$V_RRV        0 
                     (4)  IRC$V_NOPTRSZ    0 
              Record ID: 1 
              RRV ID: 1, 4-Byte Bucket Pointer: 4 
              Key: 
                       7  6  5  4  3  2  1  0          01234567 
                     ------------------------          -------- 
                            31 30 30 30 30 30|  0000  |000001  | 
 | 
  
    
       
      
BUCKET HEADER (VBN 4) 
       Check Character: %X'00' 
       Area Number: 0 
       VBN Sample: 4 
       Free Space Offset: %X'0104' 
       Free Record ID Range: 4 - 255 
       Next Bucket VBN: 4 
       Level: 0 
       Bucket Header Flags: 
              (0)  BKT$V_LASTBKT    1 
              (1)  BKT$V_ROOTBKT    0 
 | 
Figure 10-7 displays the structure of the alternate records.
Figure 10-7 Structure of Alternate Records
Example 10-7 shows an examination of an alternate record.
  
    | Example 10-7 Examining an Alternate 
    Record | 
  
  
    
       
      
SIDR RECORD (VBN 6, offset %X'000E') 
       Control Flags: 
              (4)  IRC$V_NOPTRSZ    0 
       Record ID: 1 
       Key: 
                7  6  5  4  3  2  1  0          01234567 
              ------------------------          -------- 
                        31 36 30 33 30|  0000  |03062   | 
 | 
  
    
       
      
              sidr pointer control flags: 
                     (2)  IRC$V_DELETED    0 
                     (5)  IRC$V_KEYDELETE  0 
              sidr pointer record id: 1, 4-byte record VBN: 4 
 | 
10.2 Generating an FDL File from a Data File
You can use the Analyze/RMS_File utility to create an FDL file 
generally called an analysis file. FDL files created by 
ANALYZE/RMS_FILE contain statistics about each area and key in the 
primary sections named ANALYSIS_OF_AREA and ANALYSIS_OF_KEY.
These analysis sections are then used by the Edit/FDL utility in its 
Optimize script. You can compare the statistics in these sections with 
your assumptions about the file's use; you may find some places in the 
file's structure where additional tuning will be possible.
To generate an FDL file from a data file, use the following command 
syntax:
  
    
       
      
ANALYZE/RMS_FILE/FDL filespec 
 
     | 
  
With a command of this type, the FDL file obtains its file name from 
the input file specification; to assign a different file name, use the 
/OUTPUT qualifier. For example, the following command would generate an 
FDL file named INDEXDEF.FDL from the data file CUSTFILE.DAT:
  
    
       
      
$ ANALYZE/RMS_FILE/FDL/OUTPUT=INDEXDEF CUSTFILE.DAT
 
 | 
Example 10-8 shows an FDL file showing the KEY and ANALYSIS_OF_KEY 
sections for an indexed file with two keys.
  
    | Example 10-8 KEY and ANALYSIS_OF_KEY Sections 
    in an FDL File | 
  
  
    
       
      
IDENT        2-JUN-1993 16:15:35       VMS ANALYZE/RMS_FILE Utility 
 
SYSTEM 
       SOURCE                  VMS 
FILE 
       ALLOCATION              9 
       BEST_TRY_CONTIGUOUS     no 
       BUCKET_SIZE             1 
       CONTIGUOUS              no 
       EXTENSION               0 
       GLOBAL_BUFFER_COUNT     0 
       NAME                    DISK$USERWORK:[WORK.RMS32]CUSTDATA.DAT;4 
       ORGANIZATION            indexed 
       OWNER                   [520,50] 
       PROTECTION              (system:RWED, owner:RWED, group:RWED, world:) 
       READ_CHECK              no 
       WRITE_CHECK             no 
 
RECORD 
       BLOCK_SPAN              yes 
       CARRIAGE_CONTROL        carriage_return 
       FORMAT                  variable 
       SIZE                    0 
 
AREA 0       
       BEST_TRY_CONTIGUOUS     no 
       BUCKET_SIZE             1 
       CONTIGUOUS              no 
       EXTENSION               0 
 
KEY 0 
       CHANGES                 no 
       DATA_AREA               0 
       DATA_FILL               100 
       DUPLICATES              no 
       INDEX_AREA              0 
       INDEX_FILL              100 
       LEVEL1_INDEX_AREA       0 
       NULL_KEY                no 
       PROLOG                  1 
       SEG0_LENGTH             6 
       SEG0_POSITION           0 
       TYPE                    string 
KEY 1 
       CHANGES                 no 
       DATA_AREA               0 
       DATA_FILL               100 
       DUPLICATES              yes 
       INDEX_AREA              0 
       INDEX_FILL              100 
       LEVEL1_INDEX_AREA       0 
       NULL_KEY                no 
       SEG0_LENGTH             5 
       SEG0_POSITION           68 
       TYPE                    string 
 
ANALYSIS_OF_AREA 0 
       RECLAIMED_SPACE         0 
 
ANALYSIS_OF_KEY 0 
       DATA_FILL               50 
       DATA_RECORD_COUNT       3 
       DATA_SPACE_OCCUPIED     1 
       DEPTH                   1 
       INDEX_FILL              4 
       INDEX_SPACE_OCCUPIED    1 
       MEAN_DATA_LENGTH        73 
       MEAN_INDEX_LENGTH       9 
 
ANALYSIS_OF_KEY 1 
       DATA_FILL               14 
       DATA_RECORD_COUNT       3 
       DATA_SPACE_OCCUPIED     1 
       DEPTH                   1 
       DUPLICATES_PER_SIDR     1 
       INDEX_FILL              4 
       INDEX_SPACE_OCCUPIED    1 
       MEAN_DATA_LENGTH        19 
       MEAN_INDEX_LENGTH       8 
 |