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

3- 45
set is D-ACCOUNTS.
7 This line begins the input record description of the IDACCT
file.
8 This line begins the input record description of the DACCOUNT
file. (Since records are being added only, you do not need to
define input fields.)
9 This line reads the data set, D-ACCOUNTS, randomly.
Columns 18-27 contain ACTNO to specify the key field for reading
the data set.
Columns 28-32 contain CHAIN to specify a chained read operation.
Columns 33-42 specify the name of the TurboIMAGE data set file,
DACCOUNT.
Columns 54-55 contain 80 to turn on indicator 80 when a record
is not found for the account number in D-ACCOUNTS.
10 This line specifies that exception output is performed when
indicator 80 is turned on (indicator 80 is turned on when a
record is not found for an account number).
11 This line specifies the output operation for adding records to
the D-ACCOUNTS data set.
Column 15 is E to identify this record as an exception record.
Columns 16-18 are ADD to add records to the TurboIMAGE data set.
Columns 32-37 are ADDREC to name the EXCPT Name for the record
to be added.
Deleting Records from a TurboIMAGE Data Set
This section explains how to delete records from a TurboIMAGE detail data
set. The data set must not contain duplicate keys. Records are deleted
by matching their key field values to those specified in the program.
To learn about database security provisions that can be incorporated into
your RPG programs, see the section titled "Providing Security for
TurboIMAGE Databases and Data Sets."
Figure 3-30 shows how to delete records from our sample data set
D-ACCOUNTS. (See the schema for the MARKET database in the section titled
"Defining a TurboIMAGE Database Schema.") The input file, INPUT, contains
the keys for the records to delete, though records in INPUT are not
sequenced by this key. Each record to be deleted in D-ACCOUNTS is read
first to verify that it exists. (If you need to delete records in a data
set containing duplicate keys, enter C (Chained Sequential Read) in the
Input/Output Mode for the file. Then CHAIN and delete the records until
the indicator in columns 56-57 of the CHAIN operation line turns on.)