D_CRWRITE

SUMMARY
d_crwrite(FIELD,value[,dbn])
long FIELD;
char *value;
int dbn;

ARGUMENTS
FIELD The field type from current record.
value Pointer to new value.
dbn (optional)The number of the database containing the record

DESCRIPTION
Function d_crwrite writes the data pointed to by value to data field
FIELD in current record. If FIELD is a key field, the key will
automatically be updated. If FIELD is used as a sort field for an
ascending or descending ordered set, the record's position in the set
will autimatically be adjusted accordingly. If FIELD is an array field,
the entire array is written. Elements of an array cannot be written
individually. This function cannot be used to modify fields which
comprise a compound key. Call d_recwrite to modify compound keys.

CURRENCY CHANGES
None

RETURN CODES

-5 S_INVFLD Invalid field type. You either did not pass a field
type or you passed a field type which is not in the
current record.

3 S_DUPLICATE Duplicate key

-7 S_NORC The current record is null.

-15 S_ISCOMKEY Illegal operation ussing compound key field.

-24 S_NOTLOCKED Record type containing field is not locked

-27 S_TRNOTACT Transaction not active.In shared mode,changes can
only be made from within a transaction.

-39 S_COMKEY Records containing compound keys cannot be updated

EXAMPLE

/* Change info record code
*/
chg_id(old_id,new_id)
char *old_id;
char *new_id;
{
if (d_keyfind(ID_CODE,old_id)==S_OKAY)
d_crwrite(ID_CODE,new_id);
else if (db_status==S_NOTFOUND)
printf ("id_code %d not found\n",old_id);
return;
}