Record elements of a structured data type consist in turn of record elements.
Record elements of a structured data type are
vectors,
structures and
vectors with structured elements.
A structured record element can be referenced as a complete record element or you can reference individual record elements from it in SQL statements.
Vectors
A vector is a record element of a structured data type which comprises a fixed number of components with the same data type. In the case of vector A
a single variant can be referenced in the form A
(l
) or a range of variants in the form A
(l
..m
) or the entire range of variants in the form A
or A
(1
..n
) (n
= number of variants; 1 <= l <= m <= n
).
Example
FOREIGN-LANGUAGE (3) CHARACTER(10)
The vector FOREIGN-LANGUAGE
contains 3 variants with a length of 10 of the alphanumeric data type.
Figure 12: Structured data type - vector
Structure
A structure is a group of record elements.
A structure can contain the following elements:
simple record elements of the non-structured data type,
vectors,
structures or
vectors with structured elements.
Example
CUST-ADDRESS | STRUCTURE | Structure |
|
| Simple record element |
|
| Simple record element |
|
| Simple record element |
The structure CUST-ADDRESS
consists of record elements of the alphanumeric and numeric data types.
Figure 13: Structured data type - structure
National structure
The national structure is a special case among the structures. It may only contain the following national elements:
simple record elements of the national data type,
vectors from components of the national data type,
national structures or
vectors from national structures.
A national structure is treated as a complete record element like a record element of the national data type.
Example
|
| National structure |
|
| Simple record element |
|
| Simple record element |
The structure NAME
consists of record elements of the national data type.
Figure 14: Structured data type - national structure
Vector with structured elements
A vector with structured elements is a structure with a repeating factor. The repeating factor specifies how many variants of the structure are grouped.
Example
CUST-ADDRESS | STRUCTURE(2) | Vector with structured elements |
|
| Record element |
|
| Record element |
|
| Record element |
The structure CUST-ADDRESS
occurs twice and is therefore a vector with structured elements. The record elements STREET
, ZIP
and CITY
also occur twice.
Figure 15: Structured data type - vector with structured elements