gtpc2m49C/C++ Language Support User's Guide

glob_update-Update TPF Global Field or Record

This function updates data contained in the specified TPF global field or record. All functions requested to be performed against the TPF global field or record (keypointing, processor synchronization, and others) are validated based on the definition of the tagname. If the TPF global field or record is synchronizable, glob_lock must be called before glob_update.

Format

#include <tpfglbl.h>
#include <c$globz.h>
int glob_update(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 updated.

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

length
The length of the updated data.

Normal Return

GLOB_RC_OK
The global field or record was updated successfully. If the global area is synchronizable it will be synchronized; if the global area is keypointable it will be keypointed.

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 updates a non-synchronizable global record.

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

·
·
·
{ /******************************************************************/ /* Increment data element mydata in non-synchronizable global */ /* record _myglob. */ /******************************************************************/ struct myglbrec **mgrptrptr = glob(_myglob); struct myglbrec *mgrptr = *mgrptrptr; long newdata = mgrptr->mydata + 1; glob_update(_myglob, &mgrptr->mydata, &newdata, sizeof mgrptr->mydata); }

Related Information