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

3.10 cobfa_rdnext()

Reads a record sequentially (sequential read).

long  cobfa_rdnext  (
  long  fd,            /* file descriptor */
  long  readflgs,      /* read attribute  */
  char  *recarea       /* record area     */
);

Description

In the file indicated by the file descriptor <fd>, the record immediately after (or before) the current record is read and stored in the record area <recarea>.

The read attribute <readflgs> includes the following two categories, which are associated by an OR. If omitted, default values are assigned (default: *).

Execution Conditions

File Organization

Sequential file

Executable (*)

Record sequential file

Executable (*)

Relative file

Executable (*)

Indexed file

Executable (*)

Open Mode

INPUT mode

Executable (*)

OUTPUT mode

-

I-O mode

Executable (*)

EXTEND mode

-

Access Mode

Sequential

Executable (*)

Random

-

Dynamic

Executable (*)

* : File positioning must not be optional.

Return Values

0: Successful

Function executed successfully. A code indicating the status may be set in the I-O status.

-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

FA_ENOERR

2

The value of the reference key in the record that is read is equivalent to the value of the reference key in the next record

Failure (not all) (*)

FA_ENOTOPEN

47

The specified file is opened in a mode other than INPUT mode and I-O mode. Alternatively, an invalid file descriptor is specified

FA_EBADACC

90

The file is opened with the access mode that does not allow this function to be executed

FA_EENDFILE

10

A file ending condition occurred.

FA_EBADFLAG

90

A read mode that does not allow execution of this function is specified. Alternatively, another flag specification is incorrect

FA_ENOCURR

46

Positioning to the record was undefined

FA_ELOCKED

99

The record to be positioned by sequential read has been locked

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