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

3- 13
_____________________________________
| |
| 00060010002800120013 |
| 00160020 |
| 00360040 |
| 0026001100290030 |
| 0080 |
| |
_____________________________________
Figure 3-10. Reading a KSAM File Randomly by Primary Key - RAF Entries
The KSAMUTIL entries to create a file that can be accessed randomly is
shown in the previous section "Reading a KSAM File Randomly". To process
a KSAM file randomly using a RAF, enter both a File Description and a
File Extension Specification in your program similar to those shown in
Figure 3-11. Once the program in Figure 3-11 finds a record, it displays
the first 20 characters in it.
.
Figure 3-11. Reading a KSAM File Randomly by Primary Key - Using a RAF
Comments
1 This line defines the RAF, RAFFILE.
Column 16 contains R to indicate that RAFFILE is a RAF.
Column 17 contains E to specify that the program will not end
until all records in the RAF are processed.
Column 30 is 4 to specify the length of key values in RAFFILE.
2 This line defines the KSAM file, MASTFL.
Column 28 is R to indicate that MASTFL is processed randomly.
Column 32 contains I to indicate that MASTFL is a KSAM file.
3 This line specifies that RAFFILE contains the key values for
records to be processed in MASTFL.
Reading a KSAM File Randomly and Sequentially Using the Same Key. This
section explains how to read a KSAM file both randomly and sequentially
using the same key field. Use this method when you want to process the