gtpc2m49 | C/C++ Language Support User's Guide |
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
- The argument coded as tagname must be defined in header file
c$globz.h. Results will be unpredictable if this
restriction is not heeded.
- Programs using this function should not have any pending I/O operations
outstanding because this function may perform the equivalent of a
waitc function.
- This function gets the appropriate global PSW key before updating the
specified global area. If the tagname is synchronizable, the equivalent
of a SYNCC SYNC assembler macro is performed to synchronize the global area
across the loosely coupled complex; otherwise, if the tagname is
keypointable, the equivalent of a GLOUC assembler macro is performed to
keypoint the global record specified by tagname (or the record containing the
global field). In all cases, this function returns with the PSW key set
for working storage.
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