#include <lcio.h> int kinsert(const void *rec, size_t length, void *key, FILE *f);
kinsert
function adds a new record to the keyed stream associated
with the FILE
object addressed by f
. The rec
pointer
addresses the record to be written. The length
argument indicates the
length of the record to be written (including the 4-byte key prefix for ESDS or
RRDS files). The key
pointer addresses the key data for the new record.
If key
is a NULL
pointer, the key is obtained from rec
.
For an ESDS file, the key for a new record is assigned by VSAM, not by the
program. For these files, the contents of the area addressed by key
are
ignored, but the key assigned by VSAM is stored in this area when kinsert
returns, if key
is not NULL
.
After successful completion of kinsert
, the file is positioned to the
record following the one inserted.
kinsert
function returns 0 if it is successful, or a negative value
if it is unsuccessful.
kinsert
returns a negative number, and the file's error flag is set.
However, no diagnostic message is issued by the library because this error is
frequently expected in working programs. The external variable errno
is
set to EDUPKEY
for this condition, enabling the program to distinguish
this condition from other errors.
If the run-time option =warning
is in effect, a run-time diagnostic is
generated for this condition.
kinsert
function, see
VSAM I/O Example .
kdelete
, kreplace