Top
NetCOBOL V11.0 COBOL File Access RoutinesUser's Guide
FUJITSU Software

3.16 cobfa_rewkey()

Rewrite the record indicated by the value of the primary record key (random rewrite).

long  cobfa_rewkey  (
  long  fd,                /* file descriptor         */
  const char  *recarea,    /* record area             */
  long  reclen             /* rewritten record length */
);

Description

The record specified by the value of the primary record key held in the record area <recarea> in the file indicated by the file descriptor <fd> is rewritten with the contents of the record area <recarea>.

The rewritten record length <reclen> specified is valid only if the file is in the variable-length format.

Execution Conditions

File Organization

Sequential file

-

Record sequential file

-

Relative file

-

Indexed file

Executable

Open Mode

INPUT mode

-

OUTPUT mode

-

I-O mode

Executable

EXTEND mode

-

Access Mode

Sequential

-

Random

Executable

Dynamic

Executable

Return Values

0: Successful

Function executed successfully

-1: Failed

Function failed. To get extended error information, call the cobfa_errno or cobfa_stat functions

Generated Status

Return value of cobfa_errno ()

Return value of cobfa_stat ()

Successful

FA_ENOERR

0

Function executed successfully

Failure (not all) (*)

FA_EDUPL

22

An attempt was made to rewrite with the record contents having an existing record key value to the record key not permitting duplication

FA_EBADLENG

44

The specified value of the rewritten record length is out of the permissible range

* : See "3.3 cobfa_delkey()" for additional values.