glob: Address z/TPF global field or record

This function is used to return a pointer to a global field or a record's global directory entry named in c_globz.h. Use of a term not defined in c_globz.h will have unpredictable results. To modify global fields, use the glob_modify, glob_update, or global function. For improved performance, you can update the global field directly by using the returned pointer, if the entry is running with the correct storage protection value.
Note: glob: Generate Path Name

The glob standard C library function is supported but not documented in this information; however, it is documented in z/OS C/C++ Run-Time Library Reference.

Last updated

  • Changed for PUT11.
  • Changed for PUT05.
  • Changed for PUT00.

Format

maketpf_env += system                
#include <tpf/tpfglbl.h>             
#include <tpf/c_globz.h>             
void *glob(unsigned int tagname);
tagname
This argument, which must be defined in c_globz.h, is treated as an unsigned 32-bit integer that describes the displacement, length, and attributes of the global field or record.

Normal return

A global address. If the tagname parameter describes a global field, the address of the field is returned. If the tagname parameter describes a global record, the address of the global directory for that record is returned. A global directory address can point to either the main storage address or the file address of the record, depending on how globals are defined in your system. If the tagname describes the main storage address directory for a global record, an additional level of indirection is required to address the global record itself.

Error return

Not applicable.

Programming considerations

  • Applications must call the tpf_glmod function before modifying a global field or data within a global record that resides in global area GL1 or GL3.
  • This function can only be used with z/TPF format-1 globals. To request the address of a z/TPF format-2 global, use the tpf_glWrite and tpf_glClose functions.

Examples

In the following example, the glob function returns the address of a 4-byte global field (which will be treated as an int).
#include <tpf/tpfglbl.h>
#include <tpf/c_globz.h>

int *longglob_ptr = glob(_lfld);
In the following example, the glob function returns the address of the global directory core address field for a global record. The global record itself is a struct msgexp.
#include <tpf/tpfglbl.h>
#include <tpf/c_globz.h>

struct msgexp **q05met_directory_ptr = (struct msgexp **)glob(_q05met);
struct msgexp *q05met_ptr = (struct msgexp *)(long)*(int *)q05met_directory_ptr;

Related information

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