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

3- 43
6 This line names the data set to be accessed.
Columns 54-65 contain DSNAMED-ACCOUNTS to specify that the data
set is D-ACCOUNTS.
7 This line begins the input record description of the INPUT file.
8 This line begins the input record description of the DACCOUNT
file.
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 60 to turn on indicator 60 when a record
is not found for the account number in D-ACCOUNTS. Even though
60 is not used in the program, an indicator must be entered in
this field to prevent the halt indicator (H0) from being turned
on.
10 This line begins the output record description for the DACCOUNT
file.
Adding Records to a TurboIMAGE Data Set
This section explains how to add records to a TurboIMAGE data set.
Records are added randomly and do not have to be ordered by key value.
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-29 shows how to add records to our sample data set, D-ACCOUNTS.
(See the schema for the MARKET database in the section titled "Defining a
TurboIMAGE Database Schema.") Records that are added come from the file,
IDACCT, which has the same format as the D-ACCOUNTS data set. The ACTNO
field in IDACCT is used as the key when reading D-ACCOUNTS, but the input
records are not in sequence by this key. Before a record is added to
D-ACCOUNTS, a check is made to ensure that the ACTNO record does not
already exist.