tpf_glmod: Change global storage protection

Use this function to change storage protection of the application program to match the storage protection of global areas and core resident data records.

Global areas and core resident data records reside in an area of main storage that has storage protection that is different from the storage protection used by the application program. When you need to modify a global field or a field in a core resident data record, you must change the application storage protection to match that of the global area or core resident data record.

Last updated

  • PUT05.
  • PUT00.

Format

 maketpf_env += system                           
	#include <tpf/tpfglbl.h>                        
	void	tpf_glmod(enum t_glmod key);               
key
specifies the storage protection that the application should be set to. Use one of the following defined terms:
TPF_GLOBAL1
Set storage protection to that of global area 1.
TPF_GLOBAL2
Set storage protection to that of global area 2.
TPF_GLOBAL3
Set storage protection to that of global area 3.
TPF_GLOBAL_FORMAT2_PROTECT
Set storage protection to that of protected format-2 global records.
TPF_GLOBAL_FORMAT2_UNPROTECT
Set storage protection to that of unprotected format-2 global records.

Normal return

Void

Error return

Not Applicable

Programming considerations

  • Storage protection for the application must be restored when changes to global fields or core resident record fields have been completed using the file keyword tpf_filkw or restore storage protection keyrc function.
  • After the tpf_glmod function is issued, you must restore storage protection before giving up control. If storage protection is not restored, a system error occurs.
  • You can use the tpf_glmod function to get write access to both z/TPF format-1 and format-2 globals.

Examples

The following example requests keypointing of keypointable global field _ns1ns.
#include tpf/tpfglbl.h
#include tpf/c_globz.h
	int *ns1ns;
⋮
	ns1ns = (int *)glob(_ns1ns); 								/* Get access to _ns1ns */
	tpf_glmod(TPF_GLOBAL1); 										   /* Turn off storage protection */
	*ns1ns = *ns1ns+1 												       /* Update value. */
	tpf_filkw ((enum t_filkw)(FILKW_RESTORE+FILKW_FIELD), _ns1ns);
																			               /* Request keypoint and */
																			               /* restore storage protection */
⋮

Related information

See z/TPF C functions overview for more information about z/TPF C/C++ language support.