gtpi1m5ySystem Installation Support Reference

Using the Global Area by Applications

The global area is designed primarily to be used by applications, although the control program does access it. Application programs that access or update the global area must meet certain requirements. Several application programming macros are available to the application programmer to satisfy these requirements. The examples presented in this section are only illustrations; they are not the only solution to a coding problem. A complete description for each macro can be found in TPF General Macros.

GLOBZ: Define Global Fields Macro

The application macro GLOBZ allows application programs to access the global area by defining the global fields in the global blocks of GL1 or GL3 or both. A maximum of 4096 bytes can be defined by GLOBZ for each global area. Each field in the 4096 bytes has a unique symbolic label and can be directly referenced after issuing GLOBZ. GLOBZ does the following:

The following 3 examples show how the GLOBZ macro can be coded:

Example 1

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7...
LABEL    GLOBZ REGR=R1      Load a base register with the global
                            area address.  In this case, the
                            REGR=R1 specifies GL1.  REGS=xxx
                            specifies the GL3 base, where xxx
                            is some base register.  REGC=xxx
                            specifies the "common" global fields
                            base (in MDBF), where xxx is some base
                            register.

Example 2

A FLD=xxxxxxx parameter may be used to avoid the necessity of knowing in which global area the field is stored. The appropriate address of either GL0BA or GL0BY is returned in the specified register. Either REGR or REGS can be specified with FLD, but not both.

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7...
LABEL    GLOBZ REGR=R1, FLD=@AFIELD

Example 3

GLOBZ does not define the fields of the resident data records in GL1, GL2, or GL3. In this case, each resident record type has its own data macro, and the program addresses it by loading a base register with the pointer from the appropriate directory.

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7...
LABEL    GLOBZ REGR=R1
         EX0AU REG=RG2      Assigns register 2 as base for record
                            using data macro that defines record.
         L     RG2,@EXAU    Loads record base with pointer from
                            global directory.
Note:
Loosely coupled (HPO) and tightly coupled (TC) users use the SYNCC macro to update the global area, because global synchronization is required between I-streams.

GLMOD: Change Global Protect Key Macro

All records in the GL1 or GL3 areas reside in an area of real main storage with a protection key different from that in the program status word (PSW) for application programs. Before an application program can modify any field in these areas, the GLMOD macro must be issued. GLMOD changes the protection key in the PSW of the application program to match the key of the global area.

The following example shows how to change the protection key in an area of real storage:

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7...
LABEL    GLOBZ REGR=R1
.
.
.
LABEL    GLMOD GLOBAL1     Change the global area storage
                           protection key. 'GLOBAL1' is the
                           default and need not be coded.
 

FILKW: File Keyword Macro

The FILKW macro allows application programs to request an update on the file copy of a keypoint record. FILKW is also used to restore the storage protection key to the application working storage key after an update has been made. In the following example, assume GL0BC contains the field identified as @AFIELD:

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7...
LABEL    GLOBZ REGR=R1
.
.
LABEL    GLMOD
         ST    RG5,@AFIELD   Update @AFIELD.
LABEL    FILKW R,@GLBCC      Restore the protection key and update
                             the global record, the main storage
                             address of which is located in the
                             directory at symbolic label @GLBCC.
                             The protection key must be restored
                             before the program can modify "native"
                             areas.

GL0BA: Define Global 1 Macro

The GL0BA macro has 3 functions:

The allocation of storage for GL1 should be reflected in the macro source statements set by each installation.

GL0BY: Define Global 3 Macro

The GL0BY macro has 3 functions:

The allocation of storage for GL3 should be reflected in the macro source statements set by each installation.

SYNCC: The Global Synchronization Macro

The SYNCC macro is designed to coordinate the synchronization of global area data among several active I-streams and CPCs in a TC or LC environment. The 3 SYNCC macro options are:

The FILKW and GLMOD macros should be used to update and file nonsynchronized global fields and records, which are not propagated to other active processors. The FILKW and GLMOD macros should not be used to update synchronized global fields or records; the SYNCC macro must be used to propagate the fields or records to the other active processors and create the main storage images at IPL time. SYNCC macro coding examples can be found in Examples of Coding the SYNCC Macro.

Programs that process both synchronized and nonsynchronized global fields and records must be careful to use the appropriate macros for the 2 kinds of globals.