gtpc2m46C/C++ Language Support User's Guide

glob_modify-Modify TPF Global Field or Record

This function copies the modification data to the specified TPF global field or record.

Format

#include <tpfglbl.h>
#include <c$globz.h>
int glob_modify(unsigned int tagname, void *dstptr,
                const void *srcptr, int length);

tagname
This argument, which is defined in header file c$globz.h, uniquely identifies the TPF global field or record to be accessed.

dstptr
The address of the data in the global field or record to be modified.

srcptr
The address of the data used to modify the global field or record.

length
The length of the modified data.

Normal Return

GLOB_RC_OK
The global field or record was updated successfully.

Error Return

GLOB_RC_LENGTH_ERROR
The length parameter was not a positive integer, or would have extended the overlay past the end of the global being modified (as specified by the tagname parameter).

GLOB_RC_RANGE_ERROR
The dstptr parameter was outside the range of addresses containing the global area as specified by the tagname parameter.

GLOB_RC_DIRECTORY_ERROR
The global record directory field specified by the tagname parameter is a file address. (This return applies only to global records.)

GLOB_RC_KEY_ERROR
The storage protection KEY for the global record being modified does not match the KEY for either GLOBAL1, GLOBAL2, or GLOBAL3. (This return applies only to global records.)

GLOB_RC_OVERLAP_ERROR
The global area to be modified and the modification data overlap.

Programming Considerations

Examples

The following example modifies a synchronizable global record.

#include <tpfglbl.h>
#include <c$globz.h>

·
·
·
{ /******************************************************************/ /* Increment data element mysdata in synchronizable global record */ /* _mysglob. */ /******************************************************************/ struct mysglbrec **msgrptrptr = glob_lock(_mysglob); struct mysglbrec *msgrptr = *msgrptrptr; long newdata = msgrptr->mysdata + 1; glob_modify(_mysglob, &msgrptr->mysdata, &newdata, sizeof msgrptr->mysdata); glob_sync(_mysglob); }

Related Information