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

3- 21
deleted record is encountered in MASTFL.
12 The message, DELETED/OBSOLETE RECORD, is printed when indicator
03 is on.
13 This line defines the second record format for the message file,
MSGFL.
Columns 27-28 contain 60 to print an error message when a record
is not found in MASTFL.
14 The message MISSING RECORD, is printed when indicator 60 is on.
NOTE The CHAIN operation in line 7 turns on indicator 60 when a record
is not found for the key. The program handles the error by
displaying "MISSING RECORD". If no indicator is used with the
CHAIN operation, the halt indicator H0 is turned on and, if an
error response was not entered with the Header Specification, the
program halts and performs run-time error processing.
Adding Records to a KSAM Disc File
This section explains how to add Records to a KSAM file that already
contains data. You can add records in any order. They do not have to be
in sequence by a key field.
Figure 3-18 shows how to add records to a KSAM file. You define the file
as a CHAINed file by entering C in Column 16 of the File Description
Specification. The program in this example adds records using EXCPT
output (you can add records at detail-time also). The CHAIN operation
reads the file to see if a record already exists for the value in the key
field, DEPT. If a record does not exist, it is added.
Figure 3-18. Adding Records to a KSAM File Randomly by Primary Key
Comments