INSERT (IFILE)
ANSI
The INSERT instruction adds ISAM record keys into an alternate key file. It must immediately follow a successful READ, WRITE, or DELETEK instruction.
|
|
|
|
|
Where:
label
Optional. A Program Execution Label.
afile
Required. A previously defined and opened IFILE variable into which key information is inserted.
key
Optional. A previously defined Character String Variable containing the key to insert.
Flags Affected: NONE
Note the following:
The Logical String of {key} is inserted into the ISAM key file. If {key} is a Null String, the key is extracted from the record data.
An INSERT should be performed against each secondary index after a WRITE to the primary text file. Otherwise, the secondary index may be unusable.
Since an ISAM WRITE automatically inserts the key into the primary index, this instruction should not be used for ISAM files with only one ISAM key file.
INSERT only works immediately after a READ, WRITE or DELETEK to the primary text file. Any other instruction type may cause the INSERT to perform incorrectly.
An attempt to insert a duplicate key into a file indexed with the `N' (NODUP) option generates an `I55' I/O error.
If the optional {key} is not specified, the key is retrieved from the record data previously written. This operation causes an I16 error to occur if the IFILE did not have key specifications defined when the ISI file was created.
See Also: Example Code, WRITE (IFILE), Disk I/O Instructions
![]() |