Variable-Format Part

A variable-format record consists of two parts: a fixed part and a variable part. A single record description exists for the fixed part. The variable-format part can describe several variable parts. An individual record is constructed by using the fixed part alone, or by joining the fixed part with one of the variable parts.

A variable-format part is only valid for standard and unordered data sets.

A variable-format record always contains a fixed part. The fixed part must contain one record type item and at least one required item. A record type item declaration accomplishes two things. It signals the DASDL compiler that a variable-format record is being described, and it causes a record type item to be allocated in the fixed part of the record. The fixed part can have a length of at most 393,060 characters (65510 words).

The integer label preceding the variable part is an unsigned integer used to label the part. Each variable part must be assigned a unique integer label between 1 and 254. The value of the integer label must not exceed the unsigned integer specified in the record type item declaration. The variable part can contain data items, filler items, group items, and link items; but the variable part cannot contain Accesses, control items, data sets, sets, or subsets. Each variable part can have a different length; the maximum length of any variable part is 393,060 characters (65510 words). The length of the fixed part plus the length of the variable part cannot exceed 393,060 characters.

At compilation time, DASDL calculates the number of extra areas needed for the DKTABLE. Since the records are in a variable format, and DASDL might calculate the number of extra areas based on an average record size, there might not be enough extra areas to accommodate the actual number of deleted records.

When a host language program creates a new variable-format record, it supplies an integer value indicating the type of record being created. This integer must match one of the integer labels associated with a variable part or it must be 0 (zero). The number 0 indicates that the record contains the fixed part only. This integer value is automatically stored in the record type item. When a record is retrieved from the data set, the value of the record type item can be examined to determine the type of variable-format record returned.

Data items within different variable parts need not have unique names. However, if two data items have the same name, then they must be identical in the following respects:

  • The data items must be located in the same position within the record and must be the same type and size.

  • If the NULL option appears, then the same null value must be specified for both items.

  • When the OCCURS option is used, both items must occur the same number of times.

  • Numeric items and real items must specify the identical sign, scale factor, and precision.

  • Group items within different variable parts can have the same name if they are the same size. The groups need not contain the same items.

  • Link items must always have unique names.

The following diagram illustrates the syntax for the variable-format part of a record description:

<variable-format part>

  ┌◄────────────────────────── , ──────────────────────────┐
──┴─ <integer label> : <variable-format part description> ─┴─ ; ───────┤
      ┌◄────────── ; ─────────┐
── ( ─┴─┬─<data item>───────┬─┴─┬─────┬─ ) ─┬────────────────────┬─────┤
        ├─/1\─<filler item>─┤   └─ ; ─┘     └─<verify condition>─┘
        ├─<group item>──────┤
        └─<link item>───────┘

The following examples illustrate the DASDL syntax for declaring variable-format parts of records.

Example 1

This data set contains three types of records. Type 0 records consist of the fixed part alone and contain items T and A only. Type 1 records contain items T, A, A1, and N1. Type 2 records contain items T, A, R2, A2, and B2.

D DATA SET
 (
  T RECORD TYPE(2);
  A ALPHA(3) REQUIRED;
 ),
1: (
   A1 ALPHA(12);
   N1 NUMBER(6);
  ),
2: (
   R2 REAL;
   A2 ALPHA(35);
   B2 BOOLEAN;
  );

Example 2

The fixed part contains the items VEHICLE-TYPE, LICENSE-NUMBER, DATE‑PURCHASED, and PURCHASE-PRICE. The automobile record contains the items in the fixed part and the items PASSENGERS and AIRCONDITIONED. The truck record contains the items in the fixed part and the items GROSS-VEH-WEIGHT and LOAD-CAPACITY.

VEHICLE DATA SET
 (
  VEHICLE-TYPE TYPE(2);
  LICENSE-NUMBER ALPHA(6) REQUIRED;
  DATE-PURCHASED NUMBER(4);
  PURCHASE-PRICE NUMBER(S7,2);
  )
% AUTOMOBILE RECORD
  1: (
     PASSENGERS NUMBER(1);
     AIRCONDITIONED BOOLEAN;
    ),
% TRUCK RECORD
  2: (
     GROSS-VEH-WEIGHT NUMBER(5);
     LOAD-CAPACITY NUMBER(5);
    );

Example 3

This data set contains five types of records as follows:

Record Type

Items Contained in the Data Set

0

RT and N

1

RT, N, ITEM-1, ITEM-2, ITEM-3, and ITEM-4

3

RT, N, ITEM-1,ITEM-2, ITEM-5, and ITEM-4

5

RT, N, ITEM-6, ITEM-3, and ITEM-4

7

RT, N, ITEM-7, ITEM-8, and ITEM-9

The DASDL statements for the data set declaration are

VF DATA SET
 (
  RT RECORD TYPE(15);
  N  NUMBER(5) REQUIRED;
 ),
1: (
   ITEM-1 ALPHA(6);
   ITEM-2 NUMBER(4) NULL IS 0;
   ITEM-3 REAL(8,4);
   ITEM-4 BOOLEAN OCCURS 5 TIMES;
  ),
3: (
   ITEM-1 ALPHA(6);
   ITEM-2 NUMBER(4) NULL IS 0;
   ITEM-5 FIELD(48);
   ITEM-4 BOOLEAN OCCURS 5 TIMES;
  ),
5: (
   ITEM-6 ALPHA(8);
   ITEM-3 REAL(8,4);
   ITEM-4 BOOLEAN OCCURS 5 TIMES;
  ),
7: (
   ITEM-7 NUMBER(12);
   ITEM-8 NUMBER(4);
   ITEM-9 REAL(8,4);
  );