Global items normally contain information, such as control totals, hash totals, or populations that apply to the entire database. Global items are declared and used in much the same way as items in normal data sets.
When global items are declared, a single global record is established. The global record is owned by the database; it is independent of all data sets, sets, and subsets. The global record is automatically created and initialized when the database is initialized by the INITIALIZE statement in DASDL or DMUTILITY; hence, the CREATE command is never used. The global record can be at most 393,060 characters (65510 words) in length.
The values in global items can be retrieved and modified by user application programs. The database name is used to reference the global record. The global record is retrieved using the FIND or LOCK statement. Programs modify global items by locking the global record, changing the values in the desired items, and then storing the record.
The following diagram illustrates the syntax for global items:
<global item>
──┬─<data item>───────┬────────────────────────────────────────────────┤ ├─/1\─<filler item>─┤ ├─<group item>──────┤ ├─<population item>─┤ ├─<aggregate item>──┤ └─<RSN item>────────┘
Because the global dataset contains 1 record only, the RSN item can contain only a value of 1.
Example
In this example, four global data items are declared.
A ALPHA(5) INITIALVALUE IS BLANKS; N NUMBER(S9,2) OCCURS 10 TIMES; P POPULATION (10000) OF D; R RSN; FILLER SIZE 100; D DATA SET ( K ALPHA(10); );