Updated: 11 December 1998 |
Guide to OpenVMS File Applications
Previous | Contents | Index |
The Update service (or equivalent language statement) modifies an existing record in a file. Your program must first locate the appropriate record position and optionally retrieve the record itself by calling the Find or Get service (or equivalent language statement).
The options associated with the Update service are summarized in the following table. These options can be set for each Update service if the program can access the appropriate RAB control block fields. The RAB control block fields are preset by connect-time values or defaults and as a result of previous service calls.
The Delete service (or equivalent language statement) removes a record from the file. You cannot use this service for sequential files; however, a sequential file can be truncated using the Truncate service. Like the Update service, the Delete service must be preceded by a Find or Get service to establish the current record position.
The options associated with the Delete service are summarized in the following table. These options can be set for each Delete service if the program can access the appropriate RAB control block fields. The RAB control block fields are preset by connect-time values or defaults and as a result of previous service calls.
9.4 Run-Time Example
Example 9-2 shows how to invoke the FDL$PARSE and FDL$RELEASE
routines to use the predefined control block values set by an Edit/FDL
utility editing session.
Example 9-2 Using the FDL$PARSE and FDL$RELEASE Routines |
---|
; ; This program calls the FDL utility routines FDL$PARSE and ; FDL$RELEASE. First, FDL$PARSE parses the FDL specification ; PART.FDL. Then the data file named in PART.FDL is accessed ; using the primary key. Last, the control blocks allocated ; by FDL$PARSE are released by FDL$RELEASE. ; .TITLE FDLEXAM ; .PSECT DATA,WRT,NOEXE ; MY_FAB: .LONG 0 MY_RAB: .LONG 0 FDL_FILE: .ASCID /PART.FDL/ ; Declare FDL file REC_SIZE=80 LF=10 REC_RESULT: .LONG REC_SIZE .ADDRESS REC_BUFFER REC_BUFFER: .BLKB REC_SIZE HEADING: .ASCID /ID PART SUPPLIER COLOR /[LF] ; .PSECT CODE ; ; Declare the external routines ; .EXTRN FDL$PARSE, - FDL$RELEASE ; .ENTRY FDLEXAM,^M<> ; Set up entry mask PUSHAL MY_RAB ; Get set up for call with PUSHAL MY_FAB ; addresses to receive the PUSHAL FDL_FILE ; FAB and RAB allocated by CALLS #3,G^FDL$PARSE ; FDL$PARSE BLBS R0,KEY0 ; Branch on success BRW ERROR ; Signal error ; KEY0: MOVL MY_FAB,R10 ; Move address of FAB to R10 MOVL MY_RAB,R9 ; Move address of RAB to R9 MOVL #REC_SIZE,RAB$W_USZ(R9) MOVAB REC_BUFFER,RAB$L_UBF(R9) $OPEN FAB=(R10) ; Open the file BLBC R0,F_ERROR $CONNECT RAB=(R9) ; Connect to the RAB BLBC R0,R_ERROR PUSHAQ HEADING ; Display the heading CALLS #1,G^LIB$PUT_OUTPUT BLBC R0,ERROR BRB GET_REC ; Skip error handling ; F_ERROR: BRW FAB_ERROR R_ERROR: BRW RAB_ERROR ; GET_REC: $GET RAB=(R9) ; Get a record CMPL #RMS$_EOF,R0 ; If not end of file, BEQLU CLEAN ; continue BLBC R0,R_ERROR MOVZWL RAB$W_RSZ(R9),REC_RESULT ; Move a record into PUSHAL REC_RESULT ; the buffer CALLS #1,G^LIB$PUT_OUTPUT ; Display the record BLBC R0,ERROR BRB GET_REC ; Get another record ; CLEAN: $CLOSE FAB=(R10) ; Close the FAB BLBC R0,FAB_ERROR PUSHAL MY_RAB ; Push RAB address on stack PUSHAL MY_FAB ; Push FAB address on stack CALLS #2,G^FDL$RELEASE ; Release the control blocks BLBC R0,ERROR BRB FINI ; Successful completion ; FAB_ERROR: PUSHL FAB$L_STV(R10) ; Signal file error PUSHL FAB$L_STS(R10) BRB RMS_ERR ; ERROR: PUSHL R0 ; Signal error CALLS #1,G^LIB$SIGNAL $CLOSE FAB=(R10) BRW FINI ; End program ; RAB_ERROR: PUSHL RAB$L_STV(R9) ; Signal record error PUSHL RAB$L_STS(R9) ; RMS_ERR: CALLS #2,G^LIB$SIGNAL ; FINI: RET .END FDLEXAM |
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.
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 |
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 |
Previous | Next | Contents | Index |
Copyright © Compaq Computer Corporation 1998. All rights reserved. Legal |
4506PRO_026.HTML
|