# PVK_update( ): Update an Existing Record

> Source: https://manual.pvxplus.com/c-library-file-io-routines/file-io-routines/update

## Format

int **PVK_update**(int *fh*, char \**dtabfr*, int *dtasz*, char \**keybfr*, int *keysz*);

***Where:***

|  |  |
| --- | --- |
| *fh* | File handle returned from a prior call to **[PVK_OpenExt( )](https://manual.pvxplus.com/c-library-file-io-routines/file-io-routines/openext)** |
| *dtabfr* | Pointer to the data buffer to receive the record data |
| *dtasz* | Size of the record in bytes |
| *keybfr* | Pointer to a buffer containing the external key, if applicable |
| *keysz* | Size of the external key in bytes |

## Description

**PVK_update(** **)** is used to update an existing record in a PxPlus keyed, indexed or EFF file. The **PVK_update(** **)** function will return an error if the record does not already exist.

The data buffer must contain a properly formatted record with the length of the record specified. The value supplied in *dtasz* should contain the actual size of the record rather than the size of the data buffer. **PVK_update** will pad the data record with nulls as required for files with fixed length records.

The key buffer and length must contain the necessary key information for a file with an external key. If no external key is defined for the file, then the *keysz* field must be set to zero.

The calling application is responsible for constructing a valid PxPlus data record using field separators as required.

If successful, this function will return 0; otherwise, it will return -1.
