HP RPG/XL Programmer's Guide (30318-90001)

9- 6
Comments
1 This line defines the input file, SEQ1. This is the data file
that was input to XSORT.
Column 31 contains I to specify that this file is processed by
relative record number.
2 This line defines the ADDROUT file, SEQ2, produced by XSORT.
Column 16 contains R to specify that this file is a Record
Address (address-out) file.
Column 32 contains T to specify that this is an address-out
file.
3 This line identifies SEQ2 as the address-out file containing
addresses for records in SEQ1.
KSAM Files
When you use KSAM files, follow these guidelines:
* Try to use no more than two keys.
When you use more than two, system performance degrades as the file
is updated. See the
KSAM/3000 Reference Manual
for details on using
KSAM files efficiently.
* When you do not need to access records in order by key, read the file
chronologically. See "Reading a KSAM File Chronologically" in
Chapter 3.
* When accessing a file sequentially, use large block lengths.
* When accessing a file randomly, use small block lengths.
* When appropriate, temporarily override a file's block length via the
BUF parameter of the operating system FILE command.
If a file was created with a large block length and you are
processing it randomly, enter 1 for the BUF parameter. Conversely,
if a file was created with a small block length and you need to
process it sequentially, enter a large number for the BUF parameter.
The following FILE command overrides 2, which is the default number
of buffers, and requests that 4 buffers be used for the file, DFILE.
The program, GL050, is executed next. When is processes DFILE, 4
buffers are used. Finally, the number of buffers is reset to 2 by
the RESET command:
:FILE DFILE;BUF=4
:RUN GL050
:RESET DFILE
* For systems with two or more discs, allocate the KSAM key file to one
disc and the data file to the other.
The following example assigns the KSAM data file DFILE to device
DATADISC (a symbolic name for disc drive 1). The KSAM key file is
assigned to device KEYDISC (a symbolic name for disc drive 2).
:RUN KSAMUTIL.PUB.SYS
>BUILD DFILE;DEV=DATADISC;BUILD KEYFILE;KEYDEV=KEYDISC;....
* Use multiple file extents to optimize disc space.
When you divide a file into extents, you specify how many equal parts
it can be divided into when stored on disc. Extents enable the
system software to allocate disc space as it is needed. Extents also
help prevent file overflow errors. For large files, use a large
number of extents. The following BUILD command divides the file
GLDETAIL into 24 extents. It also specifies that the file contains a
maximum of 24,000 records.
:BUILD GLDETAIL;DISC=24000,24;....
* Use address-out sorts when available disc space is limited.