_Rrlslck() — Release a Record Lock

Format

#include <recio.h>

int _Rrlslck(_RFILE *fp);

Language Level: ILE C Extension

Threadsafe: Yes.

Description

The _Rrlslck() function releases the lock on the currently locked record for the file specified by fp. The file must be open for update, and a record must be locked. If the _NO_POSITION option was specified on the _Rlocate() operation that locked the record, the record released may not be the record currently positioned to.

The _Rrlslck() function is valid for database and DDM files.

Return Value

The _Rrlslck() function returns 1 if the operation is successful, or zero if the operation is unsuccessful.

The value of errno may be set to:

Value
Meaning
ENOTUPD
The file is not open for update operations.
EIOERROR
A non-recoverable I/O error occurred.
EIORECERR
A recoverable I/O error occurred.

See Table 12 and Table 14 for errno settings.

Example that uses _Rrlslck()

#include <stdio.h>
#include <stdlib.h>
#include <recio.h>
 
int main(void)
{
    char        buf[21];
    _RFILE      *fp;
    _XXOPFB_T   *opfb;
    int         result;
 
    /* Open the file for processing in arrival sequence.             */
 
    if (( fp = _Ropen ( "MYLIB/T1677RD1", "rr+, arrseq=Y" )) == NULL )
    {
        printf ( "Open failed\n" );
        exit ( 1 );
    };
 
    /* Get the library and file names of the file opened.            */
    opfb = _Ropnfbk ( fp );
    printf ( "Library: %10.10s\nFile:    %10.10s\n",
              opfb->library_name,
              opfb->file_name);
 
    /* Get the last record.                                          */
    _Rreadl ( fp, NULL, 20, __DFT );
    printf ( "Last record: %10.10s\n", *(fp->in_buf) );
 
    /* _Rrlslck example.                                             */
    result = _Rrlslck ( fp );
    if ( result == 0 )
       printf("_Rrlslck failed.\n");
 
    _Rclose ( fp );
}

Related Information



[ Top of Page | Previous Page | Next Page | Contents | Index ]