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

3.23 cobfa_wrrec()

Write a record specified by the relative record number (random write).

long  cobfa_wrrec  (
  long  fd,                /* file descriptor        */
  const char *recarea,     /* record area            */
  long  reclen,            /* written record length  */
  unsigned long  recnum    /* relative record number */
);

Description

In the file indicated by the file descriptor <fd>, the record specified by a relative record number <recnum> is written according to the contents of the record area <recarea>.

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

Execution Conditions

File Organization

Sequential file

-

Record sequential file

-

Relative file

Executable

Indexed file

-

Open Mode

INPUT mode

-

OUTPUT mode

Executable

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 write a record by using a relative record number that already exists

FA_EBADLENG

44

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

FA_ENOTOPEN

48

The specified is opened in INPUT mode. Alternatively, an invalid file descriptor is specified

* : Typical status values are described above. For other values, see "Chapter 5 Error Number and I-O Status".