Format
#include <recio.h>
_RIOFB_T *_Rdelete(_RFILE *fp);
Language Level: ILE C Extension
Threadsafe: Yes.
Description
The _Rdelete() function deletes the record that is currently locked for update in the file specified by fp. After the delete operation, the record is not locked. The file must be open for update.
A record is locked for update by reading or locating to it unless __NO_LOCK is specified on the read or locate option. If the __NO_POSITION option is specified on the locate operation that locked the record, the record deleted may not be the record that the file is currently positioned to.
This function is valid for database and DDM files.
Return Value
The _Rdelete() function returns a pointer to the _RIOFB_T structure associated with fp. If the operation is successful, the num_bytes field contains 1. If the operation is unsuccessful, the num_bytes field contains zero.
The value of errno may be set to:
See Table 12 and Table 14 for errno settings.
Example that uses _Rdelete()
#include <stdio.h>
#include <stdlib.h>
#include <recio.h>
int main(void)
{
_RFILE *fp;
_XXOPFB_T *opfb;
/* 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 first record. */
_Rreadf ( fp, NULL, 20, __DFT );
printf ( "First record: %10.10s\n", *(fp->in_buf) );
/* Delete the first record. */
_Rdelete ( fp );
_Rclose ( fp );
}
Related Information