Adding Alternate Keys To Files - HP Guardian User Manual

Hide thumbs Also See for Guardian:
Table of Contents

Advertisement

Using FUP for Advanced File Management
PARTONLY option means that only primary or secondary partitions that reside on
$VOL1 are duplicated; partitions on other volumes are not copied. The SAVEALL
option preserves the user ID, timestamp, and security setting for each file.

Adding Alternate Keys to Files

As your databases grow and change, you may need to add new keys to existing files.
The steps for adding an alternate key to a file that already has alternate keys, and to a
file that does not have alternate keys, are shown in the following examples.
Adding an Alternate Key in an Existing Alternate-Key File
For this example, suppose that you have a file named $VOL1.SVOL.PRIFILE. This file
has an alternate-key file named $VOL1.SVOL.AFILE. You want to add the alternate-
key records for the new key field to this file.
The key specifier for the new key is NM, the key offset in the record is 4, and the key
length is 20. To add the new alternate key, enter:
-VOLUME $VOL1.SVOL
-ALTER PRIFILE, ALTKEY ( "NM", KEYOFF 4, KEYLEN 20 )
-LOADALTFILE 0, PRIFILE, ISLACK 10
The LOADALTFILE command loads the alternate-key records for key specifier NM
and any other alternate keys into the alternate-key file. To allow for future growth of the
file, you can reserve empty space in index blocks by specifying a percentage of slack
space with the LOADALTFILE ISLACK option.
However, when you add a new alternate key, the length of the key can be no longer than
the longest key already in the alternate-key file unless you:
Use the SET LIKE command to duplicate the attributes of the old alternate-key file.
Specify the new alternate key with the ALTER command.
Specify a new record and key length for the alternate-key file that is 2 + length of
the primary key + length of the longest alternate key.
For example, suppose that the file PRIFILE in the previous example has one alternate
key that is 15 bytes long. The primary-key length is 40 bytes. The name of the alternate-
key file is $VOL1.SVOL.ALTFILE. You can add a new alternate key, NM, with a
length of 20 bytes by entering:
-VOLUME $VOL1.SVOL
-ALTER PRIFILE, ALTKEY ( "NM", KEYOFF 15, KEYLEN 20 )
-SET LIKE ALTFILE
-PURGE ALTFILE!
-SET REC 62
-SET KEYLEN 62
-CREATE ALTFILE
-LOADALTFILE 0, PRIFILE
Here, the new record and key lengths must be 62 bytes (2 for the key specifier, plus 20
for the longest alternate key, plus 40 for the primary key).
Guardian User's Guide —425266-001
8- 18
Adding Alternate Keys to Files

Advertisement

Table of Contents
loading

Table of Contents