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

3-: 8
Figure 3-5. Reading a KSAM File Sequentially Within Key Limits - Supplying
Full Key Values
Comments
1 This line defines the KSAM file, MASTFL.
Column 16 is D to indicate that MASTFL is a demand file.
Column 28 is L to specify that MASTFL will be processed within
key limits.
Columns 29-30 contain 15 to specify the length of the secondary
key, LNAME.
Column 31 contains A to specify that the secondary key is an
alphanumeric key.
Column 32 contains I to specify that this is a KSAM file.
Columns 35-38 contain 25 to specify the starting location of the
key field.
2 This line specifies the starting secondary key value for reading
MASTFL.
Columns 28-32 are SETLL to position the file pointer to the
first record having a key equal to the value placed in the LNAME
field.
3 This line reads the next record in last name sequence in MASTFL
(it is included in a loop that processes only those records
whose last name is equal to LNAME.)
Columns 28-32 are READE to specify the Read Equal key operation.
Supplying Full Key Values (Method 2)
If you know the key values of records to be accessed in a KSAM file, you
can place them into a RAF and let RPG use the RAF to access records in
the KSAM file. Figure 3-6 shows ranges of department numbers (the
primary key) to be accessed in a KSAM file. The ranges are: 0005-0100,
1200-1280, 2000-2475 and 5000-5999. (The department numbers are shown
exactly as they are entered into the RAF.) You can create a RAF using any