Remap Data Item

Each data item that is included from the data set is identified using a remap data item.

Items can appear in the remap exactly as they do in the data set, be included with one or more changes, or be omitted altogether.

If the item is to appear in the remap exactly as it does in the data set, then only the name of the item need be specified. Items can be redescribed when they are included in the remap. The following changes can be made:

  • The item name can be changed.

  • A new initial value can be specified.

  • The item can be designated as hidden or read only.

  • An item which is not required in the data set can be made required in the remap.

All other attributes must remain the same.

The following diagrams illustrate the syntax for specifying a remap data item:

<remap data item>

──┬──────────────────┬┬─<alpha item name>──┬┬─────────────────────────┬─┤
  └─<identifier>─ = ─┘├─<Boolean item name>┤├─<remap data item option>┤
                      ├─<field item name>──┤└──────<comment>──────────┘
                      ├─<numeric item name>┤ 
                      └─<real item name>───┘
                                         

<remap data item option>

  ┌◄───────────────────── , ────────────────────┐
──┴─┬─/1\─ INITIALVALUE ─┬──────┬─┬─ BLANKS ──┬─┴──────────────────────┤
    │                    ├─ IS ─┤ └─<literal>─┤
    │                    └─ = ──┘             │
    ├─/1\─┬─ OCCURS <integer> TIMES ──────────┤
    │     └─ REQUIRED ────────────────────────┤
    └─/1\─┬─ HIDDEN ──────────────────────────┤
          └─ READONLY ─┬──────────────────────┤
                       ├─ GIVING EXCEPTION ───┤
                       └─ NO EXCEPTION ───────┘

The following text explains the elements of the syntax diagrams.

Identifier

The name of an item is changed by using the <identifier> = option. This option only changes the item name. All other attributes remain the same. The new name cannot exceed 30 characters.

When other item attributes are changed, the entire item must be redescribed. All attributes, except those being changed, must be identical in the remap and the data set.

Remap Data Item Option

The remap data item option respecifies the options for the data item being remapped. Any option not specified defaults to the value of that option for the data item in the physical data set. The following table explains the different remap data item options:

Option

Description

INITIALVALUE

When items are included in the remap, new initial values can be assigned to each item. If an initial value is specified in the remap, this value applies to all records created using the remap. If no initial value is specified, the initial value of the data set is used. Records created using the data set receive the initial value of the data set regardless of the initial value specified in any remap.

OCCURS

The OCCURS option is used to establish an ordered collection of items, all of which have identical attributes. The unsigned integer, following the OCCURS keyword, controls the number of times the item is repeated. The value of the unsigned integer must not exceed 1023. Whenever the occurring item is referenced, its name must be followed by a subscript enclosed within parentheses. Valid subscripts range from 1 to the value of the unsigned integer. The OCCURS specification in a remap is optional, but if it is specified, must be the same <integer> TIMES as specified in the original data set.

REQUIRED

An item can be required in the remap even though it is not required in the data set. The REQUIRED option causes the system to ensure the item is nonnull when the record is stored using the remap, but not when it is stored using the data set. Items which are required in the data set are checked, whether the items are stored using the data set or the remap.

Items which are omitted from the remap cannot be accessed and are not present in the user work area.

When an item specifying DEPENDING ON, OPTIONALLY WITH, or VARYING WITH is included in the remap, the item following DEPENDING ON, OPTIONALLY WITH, or VARYING WITH must also be included. The names of both items can be changed. The item following DEPENDING ON, OPTIONALLY WITH, or VARYING WITH must appear before the item which references it, but the items need not be adjacent.

HIDDEN

The HIDDEN option makes the item inaccessible and eliminates it from the user work area. The same effect can be achieved by simply leaving the item out of the remap altogether, but the HIDDEN option offers the following advantages:

  • It documents the omission.

  • It permits an initial value to be specified. This is especially useful if the item is required and a user program is adding new records using the remap.

  • It allows the item to be referenced in SELECT and VERIFY conditions.

The HIDDEN option is allowed for a group data item and automatically applies to all items within the group. You cannot use the HIDDEN option to hide certain items within a group (including type fields which can consist of multiple BOOLEAN subfields).

READONLY

The READONLY option indicates that the value of the item can be accessed but not altered. When you use the READONLY option, the following conditions apply:

  • The message “Mutually exclusive options requested” is given when an occurring remap item is declared as read only.

  • When READONLY or READONLY GIVING EXCEPTION is specified, a DATAERROR exception occurs at store time if a program attempts to change the value of the item.

  • If READONLY NO EXCEPTION is stipulated, no exception is returned but the store operation is prevented.

  • A create and store operation always stores the initial or null value for a read-only item. A lock and store operation always causes the item to retain its previous value.

  • When READONLY is specified for individual items within the record, READONLY ALL must not be specified for the entire record.

Remap Data Items Examples

The following four examples illustrate the DASDL syntax for remap data items.

Example 1

Items A, N, and P appear in the remap as they do in the data set.

D DATA SET
 (
  A ALPHA(10);
  N NUMBER(S5,2) NULL IS 0, REQUIRED;
  P REAL OCCURS 10 TIMES;
 );
R REMAPS D
 (
  A;
  N;
  P;
 );

Example 2

Items A and P have the same name in the remap and the data set. Item B appears as item X in the remap, and item N appear as item Y in the remap.

C COMPACT DATA SET
 (
  A ALPHA(100) SIZE VARYING;
  B BOOLEAN;
  N NUMBER(2);
  P REAL OCCURS 50 TIMES DEPENDING ON N;
 );
R REMAPS C
 (
  A;
  X = B;
  Y = N;
  P = P;
 );

Example 3

Items A, F, N, P, T1, and T2 have the same name in the remap and the data set. Item B appears as item Z, item T appears as item X, and item U appears as item Y in the remap. In addition, the remap of item T is made a required item.

D DATA SET
 (
  A ALPHA(10) INITIALVALUE BLANKS,
              NULL HIGH-VALUE;
  B BOOLEAN OCCURS 10 TIMES;
  F FIELD(4);
  N NUMBER(S5,2);
  P REAL;
  T FIELD
   (
    T1 BOOLEAN;
    T2 BOOLEAN;
   );
  U FIELD
   (
    U1;
    U2;
   );
 );
R REMAPS D
 (
  A ALPHA(10)   INITIALVALUE LOW-VALUE,
                NULL HIGH-VALUE;
  Z = B BOOLEAN OCCURS 10 TIMES,
                INITIALVALUE TRUE;
  F FIELD(4) REQUIRED;
  N NUMBER(S5,2) HIDDEN;
  P REAL READONLY;
  X = T FIELD
   (
    T1 BOOLEAN;
    T2 BOOLEAN;
   ) REQUIRED;
  Y = U;
 );

Example 4

Item A is omitted from the remap.

C COMPACT DATA SET
 (
  A ALPHA(50) SIZE VARYING;
  B BOOLEAN;
  N NUMBER(8) STORED OPTIONALLY WITH B;
 );
R REMAPS C
 (
  X = B;
  Y = N;
 );