beautypg.com

Creating a key-sequenced partitioned file – HP NonStop G-Series User Manual

Page 134

background image

Using FUP for Advanced File Management

Guardian User’s Guide 425266-001

8- 12

File-Creation Examples

To create a file in key-sequenced format with alternate keys, first enter the following
FUP commands in a file. Then run FUP, specifying the command file as the input file
with the IN option. This example shows the commands in FILE2.

Creating a Key-Sequenced Partitioned File

You do not need to keep all the data in a disk file on the same disk volume. By
partitioning a file, you can store data in a file on as many as 16 different disk volumes.
Partitioning allows you to create files that can be larger than those that reside on only
one disk. Also, because the disk heads for each disk can be repositioned at the same
time, access to data can be faster.

For example, suppose you want to create a partitioned file ($VOL1.PARTFILE.PART)
whose primary partition resides in the disk volume $VOL1. You want the primary
partition to contain the first record and all subsequent records up to, but not including,
records whose primary key begins with HA.

You also want to create secondary partitions for the file. The first partition will reside on
$VOL2, while the second will reside on $VOL3. The first secondary partition, on
$VOL2, contains records whose primary key begins with HA and subsequent records up
to, but not including, records whose primary keys begin with QU. All other records (that
is, those records whose primary keys begin with QU and all subsequent records) will
reside in the second secondary partition on $VOL3.

To create a file in key-sequenced partitioned format, enter the following FUP commands
in a file. Then run FUP, specifying the command file as the input file with the IN option.
This example shows the commands in FILE3.

20> TEDIT FILE2
VOLUME $VOL1.SVOL -- Set the default volume and
-- subvolume to the desired values.
SET TYPE K -- Set file type to key-sequenced.
SET CODE 1001 -- Set optional file code to
-- identify the file.
SET EXT (32,8) -- Set the appropriate primary and
-- secondary extent sizes for the
-- application.
SET REC 54 -- Set the record length.
SET BLOCK 4096 -- Set the block size.
SET IBLOCK 1024 -- Set the index block size.
SET KEYLEN 2 -- You must specify a primary-key
-- length for key-sequenced files.
--
-- Specify alternate keys and the name and number of
-- the alternate-key file. If FILE is not specified
-- in the SET ALTKEY command, the alternate-key file
-- number is set by default to 0.
--
SET ALTKEY ("AQ", KEYOFF 40, KEYLEN 2)
SET ALTKEY ("LO", KEYOFF 42, KEYLEN 4)
SET ALTKEY ("VN", KEYOFF 46, KEYLEN 8)
SET ALTFILE (0, INVALT)
.
.
.
SHOW -- Display current parameter values.
CREATE KEYSEQAL -- Create the file.

21 > FUP /IN FILE2/

This manual is related to the following products: