Dbupdm()

From Recital Documentation Wiki
Revision as of 14:27, 1 April 2009 by Yvonnemilne (Talk | contribs)

Jump to: navigation, search

PURPOSE

update memo in a memo file


SYNOPSIS

#include "dbl.h"
 
	int	dbpudm(dbt, memo, field, oldfield)
 
	<input parameters>
	char	*dbt;		/* .DBT file descriptor			*/
	char	*memo		/* Address of a buffer containing the memo to be put into the file		*/
	char	*oldfield;	/* Address of old memo field which should be released, 0 if no reclaim of space is to be made	*/
 
	<output parameters>
	char	*field;		/* Address in the record buffer where the memo is stored			*/


RETURN VALUE

The dbupdm() function returns 0 for success. See the section on return value codes for a detailed list of failure codes.


DESCRIPTION

This function updates a memo in the specified .dbt file. The memo to be updated must first be acquired by using dbgetr() or by other means. The last parameter of this function controls the reallocation of existing memo entries. If the address is specified, the function adds the existing memo entry to the free block list which controls allocation of space in the .dbt file. The address will usually be the same as the third parameter. If no reallocation is desired, the fourth parameter is null (0). This function does not automatically update the memo pointer in the record. The function dbputr() or others that commit records must be used.


EXAMPLE

The following example adds more information to the end of an existing memo entry. Note the use of dbgetr() and dbgetm(). It is assumed that the 4 byte memo pointer starts at the 54th array element (&record[53]).

#include "dbl.h"
 
	int	dbf, dbt;
	char	record[1000];
	char	status;
	int	rc;
	char	memobuffer[512];
 
	if(rc = dbgetr, (long) 2, record, &status) !=0) {
		printf("Get Memo Failure: %dn", rc);
		exit(1);
	}
 
	if(rc = dbgetm( dbt, &record[53], memobuffer, 0) !=0) {
		printf("Get Memo Failure: %dn", rc);
		exit(1);
	}
 
	strcat(memobuffer,
		"This string is appended to the end of the retrieved
			  memo");
 
	if(rc = dbupdm( dbt, memobuffer,
			&record[53],
			&record[53]) !=0) {
		printf("Memo Update Failure: %dn",rc);
		exit(1);
	}
 
	if(rc = dbupdr(dbf, (long)2, record) !=0) {
		printf("Record Update failure: %dn", rc);
		exit(1);
	}


SEE ALSO

dbgetm(), dbgetr(), dbmopen(), dbputm(), dbputr()