HP OpenVMS Systems Documentation

Content starts here

Guide to OpenVMS File Applications


Previous Contents Index


Chapter 10
Maintaining Files

Designing and creating your files and defining their records are only the first steps in the life cycle of your file. You must also consider maintaining the file.

This chapter describes file maintenance with the emphasis on file tuning.

Section 10.1 describes how you can use the Analyze/RMS_File utility to view the characteristics of a file. Section 10.2 describes how you can create an FDL file from a data file using the Analyze/RMS_File utility. Section 10.3 explains how to use the Edit/FDL utility, particularly with Analyze/RMS_File, to optimize and redesign file characteristics. Section 10.4 describes how to make a file contiguous. Section 10.5 explains how to reorganize a file, and Section 10.6 describes how to make archive copies of a file.

10.1 Viewing File Characteristics

The Analyze/RMS_File utility (ANALYZE/RMS_FILE) allows you to inspect and analyze the internal structure of an OpenVMS RMS (hereafter referred to as RMS) file.

ANALYZE/RMS_FILE can check a file's structure for errors and can generate a statistical or summary report. A summary report is identical to a statistical report except that no checking is done. For more information on producing a summary report, see the description of the Analyze/RMS_File utility in the OpenVMS Record Management Utilities Reference Manual.

You can also inspect and analyze your file using the Analyze/RMS_File utility interactively. The analysis can show whether or not the file is properly designed for its application and can point out ways to improve the file design.

In addition, you can use ANALYZE/RMS_FILE to obtain FDL files from data files. You can then use these FDL files with the Create/FDL utility (CREATE/FDL), the Convert utility (CONVERT), and the Edit/FDL utility, (EDIT/FDL). FDL files created with ANALYZE/RMS_FILE contain special analysis sections for each area and key, which are called ANALYSIS_OF_AREA and ANALYSIS_OF_KEY. The Edit/FDL utility uses these sections in the Optimize script to tune the file's structure.

10.1.1 Performing an Error Check

To check a file's structure for errors, use the following command syntax:


ANALYZE/RMS_FILE/CHECK filespec

By default with a command of this format, the Check report is displayed on the terminal (SYS$OUTPUT).

If you receive any error messages, the file has been corrupted by a serious error. If you have had a hardware problem such as a power failure or a disk head failure, then the hardware probably caused the corruption. If you have not had any hardware problems, then a software error may have caused the corruption. Note that the /CHECK qualifier does not find all types of file corruption, however.

In either case, you can try using the Convert utility to fix the problem by using the file specification as both the input-filespec and the output-filespec. Note that if you are processing a relative file containing deleted or unused records, the conversion process changes relative record numbers (RRN) in the output file. If the conversion does not correct the problem, use the Backup utility (BACKUP) to bring in the backup copy of the file.

For more information about CONVERT and BACKUP, see Section 10.4.2, Section 10.5, and Section 10.6.

Note

If you believe that the software caused the error, contact a Compaq support representative. Supply the ANALYZE/RMS_FILE check report, a copy of the data file, and a description of what was done with the data file. If possible, also supply a version of the file prior to the corruption and the program or procedure which led to the corruption; being able to reproduce the problem is of tremendous value.

Example 10-1 is a sample Check report of a file with the file specification DISK$:[HERBER]CUSTDATA.DAT;2.

Example 10-1 Using ANALYZE/RMS_FILE to Create a Check Report

Check RMS File Integrity                     14-JUN-1993 21:51:47.38   Page 1
DISK$:[HERBER]CUSTDATA.DAT;2

FILE HEADER

        File Spec: DISK$:[HERBER]CUSTDATA.DAT;2
        File ID: (10044,39,1)
        Owner UIC: [011,310]
        Protection:  System: RWED, Owner: RWED, Group: RWE, World: RWE
        Creation Date:    9-JUN-1993 22:30:24.78
        Revision Date:    9-JUN-1993 22:30:30.86, Number: 4
        Expiration Date: none specified
        Backup Date:     none posted
        Contiguity Options:  none
        Performance Options: none
        Reliability Options: none
        Journaling Enabled: none


RMS FILE ATTRIBUTES

        File Organization: indexed
        Record Format: variable
        Record Attributes:   carriage-return
        Maximum Record Size: 80
        Blocks Allocated: 30, Default Extend Size: 2
        Bucket Size: 1
        File Monitoring: disabled
        Global Buffer Count: 0


FIXED PROLOG

        Number of Areas: 8, VBN of First Descriptor: 3
        Prolog Version: 3

AREA DESCRIPTOR #0 (VBN 3, offset %X'0000')

        Bucket Size: 1
        Reclaimed Bucket VBN: 0
        Current Extent Start: 1, Blocks: 9, Used: 4, Next: 5
        Default Extend Quantity: 2
        Total Allocation: 9

AREA DESCRIPTOR #1 (VBN 3, offset %X'0040')

        Bucket Size: 1
        Reclaimed Bucket VBN: 0
        Current Extent Start: 10, Blocks: 3, Used: 1, Next: 11
        Default Extend Quantity: 1

AREA DESCRIPTOR #2 (VBN 3, offset %X'0080')

        Bucket Size: 1
        Reclaimed Bucket VBN: 0
        Current Extent Start: 13, Blocks: 3, Used: 1, Next: 14
        Default Extend Quantity: 1
        Total Allocation: 3

AREA DESCRIPTOR #3 (VBN 3, offset %X'00C0')

        Bucket Size: 1
        Reclaimed Bucket VBN: 0
        Current Extent Start: 16, Blocks: 3, Used: 1, Next: 17
        Default Extend Quantity: 1
        Total Allocation: 3

AREA DESCRIPTOR #4 (VBN 3, offset %X'0100')

        Bucket Size: 1
        Reclaimed Bucket VBN: 0
        Current Extent Start: 19, Blocks: 3, Used: 1, Next: 20
        Default Extend Quantity: 1
        Total Allocation: 3

AREA DESCRIPTOR #5 (VBN 3, offset %X'0140')

        Bucket Size: 1
        Reclaimed Bucket VBN: 0
        Current Extent Start: 22, Blocks: 3, Used: 1, Next: 23
        Default Extend Quantity: 1
        Total Allocation: 3

AREA DESCRIPTOR #6 (VBN 3, offset %X'0180')

        Bucket Size: 1
        Reclaimed Bucket VBN: 0
        Current Extent Start: 25, Blocks: 3, Used: 1, Next: 26
        Default Extend Quantity: 1
        Total Allocation: 3

AREA DESCRIPTOR #7 (VBN 3, offset %X'01C0')

        Bucket Size: 1
        Reclaimed Bucket VBN: 0
        Current Extent Start: 28, Blocks: 3, Used: 1, Next: 29
        Default Extend Quantity: 1
        Total Allocation: 3
KEY DESCRIPTOR #0 (VBN 1, offset %X'0000')

        Next Key Descriptor VBN: 2, Offset: %X'0000'
        Index Area: 1, Level 1 Index Area: 1, Data Area: 0
        Root Level: 1
        Index Bucket Size: 1, Data Bucket Size: 1
        Root VBN: 10
        Key Flags:
                (0)  KEY$V_DUPKEYS    0
                (3)  KEY$V_IDX_COMPR  0
                (4)  KEY$V_INITIDX    0
                (6)  KEY$V_KEY_COMPR  0
                (7)  KEY$V_REC_COMPR  1

        Key Segments: 1
        Key Size: 4
        Minimum Record Size: 4
        Index Fill Quantity: 512, Data Fill Quantity: 512
        Segment Positions:       0
        Segment Sizes:           4
        Data Type: string
        Name: "PART_NUM"
        First Data Bucket VBN: 4

KEY DESCRIPTOR #1 (VBN 2, offset %X'0000')

        Next Key Descriptor VBN: 2, Offset: %X'0066'
        Index Area: 3, Level 1 Index Area: 3, Data Area: 2
        Root Level: 1
        Index Bucket Size: 1, Data Bucket Size: 1
        Root VBN: 16
        Key Flags:
                (0)  KEY$V_DUPKEYS    1
                (1)  KEY$V_CHGKEYS    0
                (2)  KEY$V_NULKEYS    0
                (3)  KEY$V_IDX_COMPR  0
                (4)  KEY$V_INITIDX    0
                (6)  KEY$V_KEY_COMPR  0
        Key Segments: 1
        Key Size: 5
        Minimum Record Size: 9
        Index Fill Quantity: 512, Data Fill Quantity: 512
        Segment Positions:       4
        Segment Sizes:           5
        Data Type: string
        Name: "PART_NAME"
        First Data Bucket VBN: 13
KEY DESCRIPTOR #2 (VBN 2, offset %X'0066')

        Next Key Descriptor VBN: 2, Offset: %X'00CC'
        Index Area: 5, Level 1 Index Area: 5, Data Area: 4
        Root Level: 1
        Index Bucket Size: 1, Data Bucket Size: 1
        Root VBN: 22
        Key Flags:
                (0)  KEY$V_DUPKEYS    1
                (1)  KEY$V_CHGKEYS    0
                (2)  KEY$V_NULKEYS    0
                (3)  KEY$V_IDX_COMPR  1
                (4)  KEY$V_INITIDX    0
                (6)  KEY$V_KEY_COMPR  1
        Key Segments: 1
        Key Size: 10
        Minimum Record Size: 19
        Index Fill Quantity: 512, Data Fill Quantity: 512
        Segment Positions:       9
        Segment Sizes:          10
        Data Type: string
        Name: "SUPPLIER_NAME"
        First Data Bucket VBN: 19

KEY DESCRIPTOR #3 (VBN 2, offset %X'00CC')

        Index Area: 7, Level 1 Index Area: 7, Data Area: 6
        Root Level: 1
        Index Bucket Size: 1, Data Bucket Size: 1
        Root VBN: 28
        Key Flags:
                (0)  KEY$V_DUPKEYS    1
                (1)  KEY$V_CHGKEYS    0
                (2)  KEY$V_NULKEYS    0
                (3)  KEY$V_IDX_COMPR  1
                (4)  KEY$V_INITIDX    0
                (6)  KEY$V_KEY_COMPR  1
        Key Segments: 1
        Key Size: 10
        Minimum Record Size: 29
        Index Fill Quantity: 512, Data Fill Quantity: 512
        Segment Positions:      19
        Segment Sizes:          10
        Data Type: string
        Name: "COLOR"
        First Data Bucket VBN: 25


The analysis uncovered NO errors.


ANALYZE/RMS_FILE/OUTPUT=CUSTDATA.ANL CUSTDATA.DAT

To place the Check report in a file, use a command of the form:


ANALYZE/RMS_FILE/CHECK/OUTPUT=output-filespec input-filespec

The Check report will be placed in the file you named with the output-filespec parameter. This file will receive the file type .ANL by default. For example, the following command will perform an error check on PRLG2.IDX and place the Check report in the file ERROR.ANL:


$ ANALYZE/RMS_FILE/CHECK/OUTPUT=ERROR PRLG2.IDX

10.1.2 Generating a Statistics Report

For indexed files, the Statistics report consists of the Check report plus additional information about the areas and keys in the file. (A Statistics report on a sequential or relative file is thus the same as a Check report.)

To generate a Statistics report with ANALYZE/RMS_FILE, enter a DCL command of the form:


ANALYZE/RMS_FILE/STATISTICS filespec

Example 10-2 is an example of a Statistics report.

Example 10-2 Using ANALYZE/RMS_FILE to Create a Statistics Report

RMS File Statistics                          18-APR-1993 11:22:27.14   Page 1
DISK$:[TEST.PROGRAM]INDEX.DAT;1


FILE HEADER

        File Spec: DISK$:[TEST.PROGRAM]INDEX.DAT;1
        File ID: (15960,8,0)
        Owner UIC: [011,310]
        Protection:  System: RWED, Owner: RWED, Group: RWED, World: RWE
        Creation Date:   19-APR-1993 22:15:55.70
        Revision Date:   19-APR-1993 22:16:01.74, Number: 4
        Expiration Date: none specified
        Backup Date:     18-APR-1993 00:57:54.24
        Contiguity Options:  contiguous-best-try
        Performance Options: none
        Reliability Options: none
        Journaling Enabled:  none

RMS FILE ATTRIBUTES

        File Organization: indexed
        Record Format: variable
        Record Attributes:   carriage-return
        Maximum Record Size: 80
        Blocks Allocated: 30, Default Extend Size: 2
        Bucket Size: 1
        File Monitoring: disabled
        Global Buffer Count: 0


FIXED PROLOG

        Number of Areas: 8, VBN of First Descriptor: 3
        Prolog Version: 3

AREA DESCRIPTOR #0 (VBN 3, offset %X'0000')

        Bucket Size: 1
        Reclaimed Bucket VBN: 0
        Current Extent Start: 1, Blocks: 9, Used: 4, Next: 5
        Default Extend Quantity: 2
        Total Allocation: 9

STATISTICS FOR AREA #0

        Count of Reclaimed Blocks:              0

AREA DESCRIPTOR #1 (VBN 3, offset %X'0040')

        Bucket Size: 1
        Reclaimed Bucket VBN: 0
        Current Extent Start: 10, Blocks: 3, Used: 1, Next: 11
        Default Extend Quantity: 1
        Total Allocation: 3

STATISTICS FOR AREA #1

        Count of Reclaimed Blocks:              0

AREA DESCRIPTOR #2 (VBN 3, offset %X'0080')

        Bucket Size: 1
        Reclaimed Bucket VBN: 0
        Current Extent Start: 13, Blocks: 3, Used: 1, Next: 14
        Default Extend Quantity: 1
        Total Allocation: 3

STATISTICS FOR AREA #2

        Count of Reclaimed Blocks:              0
AREA DESCRIPTOR #3 (VBN 3, offset %X'00C0')

        Bucket Size: 1
        Reclaimed Bucket VBN: 0
        Current Extent Start: 16, Blocks: 3, Used: 1, Next: 17
        Default Extend Quantity: 1
        Total Allocation: 3

STATISTICS FOR AREA #3

        Count of Reclaimed Blocks:              0

AREA DESCRIPTOR #4 (VBN 3, offset %X'0100')

        Bucket Size: 1
        Reclaimed Bucket VBN: 0
        Current Extent Start: 19, Blocks: 3, Used: 1, Next: 20
        Default Extend Quantity: 1
        Total Allocation: 3

STATISTICS FOR AREA #4

        Count of Reclaimed Blocks:              0

AREA DESCRIPTOR #5 (VBN 3, offset %X'0140')

        Bucket Size: 1
        Reclaimed Bucket VBN: 0
        Current Extent Start: 22, Blocks: 3, Used: 1, Next: 23
        Default Extend Quantity: 1
        Total Allocation: 3

STATISTICS FOR AREA #5

        Count of Reclaimed Blocks:              0

AREA DESCRIPTOR #6 (VBN 3, offset %X'0180')

        Bucket Size: 1
        Reclaimed Bucket VBN: 0
        Current Extent Start: 25, Blocks: 3, Used: 1, Next: 26
        Default Extend Quantity: 1
        Total Allocation: 3

STATISTICS FOR AREA #6

        Count of Reclaimed Blocks:              0

AREA DESCRIPTOR #7 (VBN 3, offset %X'01C0')

        Bucket Size: 1
        Reclaimed Bucket VBN: 0
        Current Extent Start: 28, Blocks: 3, Used: 1, Next: 29
        Default Extend Quantity: 1
        Total Allocation: 3
STATISTICS FOR AREA #7

        Count of Reclaimed Blocks:              0

KEY DESCRIPTOR #0 (VBN 1, offset %X'0000')

        Next Key Descriptor VBN: 2, Offset: %X'0000'
        Index Area: 1, Level 1 Index Area: 1, Data Area: 0
        Root Level: 1
        Index Bucket Size: 1, Data Bucket Size: 1
        Root VBN: 10
        Key Flags:
                (0)  KEY$V_DUPKEYS    0
                (3)  KEY$V_IDX_COMPR  0
                (4)  KEY$V_INITIDX    0
                (6)  KEY$V_KEY_COMPR  0
                (7)  KEY$V_REC_COMPR  1
        Key Segments: 1
        Key Size: 4
        Minimum Record Size: 4
        Index Fill Quantity: 512, Data Fill Quantity: 512
        Segment Positions:       0
        Segment Sizes:           4
        Data Type: string
        Name: "ID_NUM"
        First Data Bucket VBN: 4

STATISTICS FOR KEY #0

        Number of Index Levels:                 1
        Count of Level 1 Records:               1
        Mean Length of Index Entry:             6
        Count of Index Blocks:                  1
        Mean Index Bucket Fill:                 4%
        Mean Index Entry Compression:           0%

        Count of Data Records:                 10
        Mean Length of Data Record:            33
        Count of Data Blocks:                   1
        Mean Data Bucket Fill:                 90%
        Mean Data Key Compression:              0%
        Mean Data Record Compression:          -2%

        Overall Space Efficiency:               2%

KEY DESCRIPTOR #1 (VBN 2, offset %X'0000')

        Next Key Descriptor VBN: 2, Offset: %X'0066'
        Index Area: 3, Level 1 Index Area: 3, Data Area: 2
        Root Level: 1
        Index Bucket Size: 1, Data Bucket Size: 1
        Root VBN: 16
        Key Flags:
                (0)  KEY$V_DUPKEYS    1
                (1)  KEY$V_CHGKEYS    0
                (2)  KEY$V_NULKEYS    0
                (3)  KEY$V_IDX_COMPR  0
                (4)  KEY$V_INITIDX    0
                (6)  KEY$V_KEY_COMPR  0
        Key Segments: 1
        Key Size: 5
        Minimum Record Size: 9
        Index Fill Quantity: 512, Data Fill Quantity: 512
        Segment Positions:       4
        Segment Sizes:           5
        Data Type: string
        Name: "ID_NAME"
        First Data Bucket VBN: 13

STATISTICS FOR KEY #1

        Number of Index Levels:                 1
        Count of Level 1 Records:               1
        Mean Length of Index Entry:             7
        Count of Index Blocks:                  1
        Mean Index Bucket Fill:                 4%
        Mean Index Entry Compression:           0%

        Count of Data Records:                  6
        Mean Duplicates per Data Record:        0
        Mean Length of Data Record:            19
        Count of Data Blocks:                   1
        Mean Data Bucket Fill:                 24%
        Mean Data Key Compression:              0%

KEY DESCRIPTOR #2 (VBN 2, offset %X'0066')

        Next Key Descriptor VBN: 2, Offset: %X'00CC'
        Index Area: 5, Level 1 Index Area: 5, Data Area: 4
        Root Level: 1
        Index Bucket Size: 1, Data Bucket Size: 1
        Root VBN: 22
        Key Flags:
                (0)  KEY$V_DUPKEYS    1
                (1)  KEY$V_CHGKEYS    0
                (2)  KEY$V_NULKEYS    0
                (3)  KEY$V_IDX_COMPR  1
                (4)  KEY$V_INITIDX    0
                (6)  KEY$V_KEY_COMPR  1
        Key Segments: 1
        Key Size: 10
        Minimum Record Size: 19
        Index Fill Quantity: 512, Data Fill Quantity: 512
        Segment Positions:       9
        Segment Sizes:          10
        Data Type: string
        Name: "ADDRESS"
        First Data Bucket VBN: 19

STATISTICS FOR KEY #2

        Number of Index Levels:                 1
        Count of Level 1 Records:               1
        Mean Length of Index Entry:            12
        Count of Index Blocks:                  1
        Mean Index Bucket Fill:                 4%
        Mean Index Entry Compression:          58%

        Count of Data Records:                  7
        Mean Duplicates per Data Record:        0
        Mean Length of Data Record:            20
        Count of Data Blocks:                   1
        Mean Data Bucket Fill:                 30%
        Mean Data Key Compression:             21%

KEY DESCRIPTOR #3 (VBN 2, offset %X'00CC')

        Index Area: 7, Level 1 Index Area: 7, Data Area: 6
        Root Level: 1
        Index Bucket Size: 1, Data Bucket Size: 1
        Root VBN: 28
        Key Flags:
                (0)  KEY$V_DUPKEYS    1
                (1)  KEY$V_CHGKEYS    0
                (2)  KEY$V_NULKEYS    0
                (3)  KEY$V_IDX_COMPR  1
                (4)  KEY$V_INITIDX    0
                (6)  KEY$V_KEY_COMPR  1
        Key Segments: 1
        Key Size: 10
        Minimum Record Size: 29
        Index Fill Quantity: 512, Data Fill Quantity: 512
        Segment Positions:      19
        Segment Sizes:          10
        Data Type: string
        Name: "CHARGES"
        First Data Bucket VBN: 25

STATISTICS FOR KEY #3

        Number of Index Levels:                 1
        Count of Level 1 Records:               1
        Mean Length of Index Entry:            12
        Count of Index Blocks:                  1
        Mean Index Bucket Fill:                 4%
        Mean Index Entry Compression:          58%

        Count of Data Records:                  5
        Mean Duplicates per Data Record:        1
        Mean Length of Data Record:            23
        Count of Data Blocks:                   1
        Mean Data Bucket Fill:                 25%
        Mean Data Key Compression:             34%



The analysis uncovered NO errors.


ANALYZE/RMS_FILE/OUTPUT=INDEX/STATISTICS INDEX.DAT

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.


Previous Next Contents Index