Global Data Remap

Global data can be redescribed using a global data remap. Global data remaps enable the database administrator to alter the appearance of the global data record and to control how the items in the record are accessed. Global data remaps also provide data independence exactly as remaps do.

Several different remaps can be declared for the global data record. Each global data remap is declared much like a normal data set remap. Global data is automatically invoked when the database is invoked directly; thus, global data remaps can be used only with logical databases. Each logical database can omit global data altogether, it can invoke the actual global data record, or it can invoke a global data remap.

Items need not be declared in the same order in the remap as they were in the original global record. When possible, however, the items should be preserved in the original sequence to improve run-time efficiency.

The following diagrams illustrate the syntax for a global data remap:

<global data remap>

── <global data remap name> REMAPS <database name> ─┬───────────┬──────►
                                                    └─<comment>─┘

►─┬────────────────┬─<global data remap record description>────────────┤
  └─<remap option>─┘

<remap option>

  ┌◄───────────────────── , ────────────────────┐
──┴─┬─/1\─ REQUIRED ALL ──────────────────────┬─┴──────────────────────┤
    └─/1\─ READONLY ALL ─┬────────────────────┤
                         ├─ NO EXCEPTION ─────┤
                         └─ GIVING EXCEPTION ─┘

<global data remap record description>

      ┌◄────────────── ; ─────────────┐
── ( ─┴─┬─<remap data item>─────────┬─┴─┬─────┬─ ) ────────────────────┤
        ├─/1\─<filler item>─────────┤   └─ ; ─┘
        ├─<remap group item>────────┤
        ├─<remap population item>───┤
        ├─<remap aggregate item>────┤
        ├─<virtual data item>───────┤
        ├─<virtual group item>──────┤
        └─<virtual population item>─┘

The following table explains the elements of the syntax diagrams:

Option

Description

<global data remap name>

The global data remap name is an identifier that names the global data remap. The global data remap name cannot exceed 30 bytes.

<database name>

The database name must be the name specified in the compiler control card when the database description is compiled. The database name signifies that the global data record is being redescribed.

REQUIRED ALL

The REQUIRED ALL option is used to ensure that all global items within a remap are assigned a value. Specifying REQUIRED ALL is equivalent to specifying REQUIRED for every global item in the remap for which REQUIRED is valid.

When the global data record is stored, the system tests all required items. If a required item contains a null value, the program doing the store operation receives an exception and the record is not stored. Using the REQUIRED ALL option does not make an occurring item required.

READONLY ALL

The READONLY ALL option prevents programs from modifying the global data record. When READONLY ALL is specified, programs can retrieve the record and examine its contents; however, they cannot delete or store the record. If READONLY ALL or READONLY ALL GIVING EXCEPTION is stipulated, then a DATAERROR exception is returned when one of these operations is attempted. If READONLY ALL NO EXCEPTION is specified, the operation is prevented, but no exception is returned.

When READONLY ALL is specified, READONLY must not be specified for individual global items.

<global data remap record description>

The global data remap record description indicates which global items are to be included in the remap. Original global items can be included, and new filler items and virtual items can be declared.

All items in the global data remap, except filler items and virtual items, must be present in the original global data record. Items can be included exactly as they appeared originally, they can be included with a change of name, or they can be included with some options changed. The options which can be changed depend upon the item type. These restrictions are discussed separately with each item type.

Global items can be left out of the global data remap entirely. Omitted items are neither available to user programs nor present in the user work area.

Example

The following example illustrates the DASDL syntax for a global data remap:

% GLOBAL DATA ITEMS
A ALPHA(20);
N NUMBER(5,2);
P POPULATION(1000) OF D;
AG AGGREGATE (12) COUNT (K NEQ BLANKS) OF D;
D DATA SET
 (
  K ALPHA(10);
 );
G REMAPS DBNAME
 (
  X = A;
  N NUMBER(5,2) INITIALVALUE 100, HIDDEN;
  AG;
  V VIRTUAL BOOLEAN = TRUE;
  Q VIRTUAL POPULATION(100) = 0;
 );