The view-definition option used with
DEFINE DATA LOCAL
and
DEFINE DATA OBJECT
has the following syntax:
view-name
VIEW [OF ]
ddm-name |
level | ddm-field | ([format-length][/array-definition]) | [emhdpm] | ||||||||||||||||||
|
[/array-definition] |
DYNAMIC |
||||||||||||||||||||
redefinition |
This document covers the following topics:
For an explanation of the symbols used in the syntax diagram, see Syntax Symbols.
A view-definition is used to define a data view as derived from a data definition module (DDM).
Note:
In a parameter data area, view-definition
is not permitted.
For further information, see the section Accessing Data in an Adabas Database in the Programming Guide and particularly the following topics:
view-name | The name to be assigned to the view. Rules for Natural variable names apply; see Naming Conventions for User-Defined Variables in the Using Natural documentation.. |
---|---|
VIEW [OF] ddm-name | The name of the DDM from which the view is to be taken. |
level | Level number is a 1- or 2-digit number in the range from 01 to
99 (the leading zero is optional) used in conjunction with field grouping.
Fields assigned a level number of 02 or greater are considered to be a part of
the immediately preceding group which has been assigned a lower level number.
The definition of a group enables reference to a series of fields
(may also be only one field) by using the group name. With certain statements
( A group may consist of other groups. When assigning the level numbers for a group, no level numbers may be skipped. |
ddm-field | The name of a field to be taken from the DDM.
When you define a view for a |
redefinition | A redefinition may be used to redefine a group, a view, a DDM field or a single field/variable (that is a scalar or an array). See section Redefinition. |
format-length |
Format and length of the field. If omitted these are taken from the DDM. In structured mode, the definition of format and length (if supplied) must be the same as those in the DDM. In reporting mode, the definition of format and length (if supplied) must be type-compatible with those in the DDM. |
A, U or B | Data type: alphanumeric (A), Unicode (U) or binary (B) for
dynamic variables.
Notes:
|
array-definition | Depending on the programming mode used, arrays (periodic-group fields, multiple-value fields) may have to contain information about their occurrences. See the section Array Definition in a View below. |
emhdpm | With this option, additional parameters to be in effect for a field/variable may be defined. See EM, HD, PM Parameters for Field/Variable. |
DYNAMIC | Defines a view field as DYNAMIC . For more
information on processing dynamic variables, see the section
Using Dynamic and Large
Variables.
|
Depending on the programming mode used, arrays (periodic-group fields, multiple-value fields) may have to contain information about their occurrences.
If a field is used in a view that represents an array, the following applies:
An index value must be specified for MU/PE fields
When no format/length specification is supplied, the values are taken from the DDM.
When a format/length specification is supplied, it must be the same as in the DDM.
Adabas: | If MU/PE fields (defined in a DDM) are to be used inside a view, these fields must include an array index specification. For an MU field or ordinary PE field, you specify a one-dimensional index range, e.g. (1:10). For an MU field inside a PE group, you specify a two-dimensional index range, e.g. (1:10,1:5). |
---|
DEFINE DATA LOCAL 1 EMP1 VIEW OF EMPLOYEES 2 NAME(A20) 2 ADDRESS-LINE(A20 / 1:2) 1 EMP2 VIEW OF EMPLOYEES 2 NAME 2 ADDRESS-LINE(1:2) 1 EMP3 VIEW OF EMPLOYEES 2 NAME 2 ADDRESS-LINE(2) 1 #K (I4) 1 EMP4 VIEW OF EMPLOYEES 2 NAME 2 ADDRESS-LINE(#K:#K+1) END-DEFINE END
In this mode, the same rules are valid as for structured mode. However, there are two exceptions:
An index value needs not be supplied. In this case, the index range for the missing dimensions is set to (1:1).
The format/length specification may differ from the specification in the DDM. Then the definition of format and length must be type-compatible with those in the DDM.
DEFINE DATA LOCAL 1 EMP1 VIEW OF EMPLOYEES 2 NAME(A30) 2 ADDRESS-LINE(A35 / 5:10) 1 EMP2 VIEW OF EMPLOYEES 2 NAME 2 ADDRESS-LINE(A40) /* ADDRESS LINE (1:1) IS ASSUMED 1 EMP3 VIEW OF EMPLOYEES 2 NAME 2 ADDRESS-LINE /* ADDRESS LINE (1:1) IS ASSUMED 1 #K (I4) 1 EMP4 VIEW OF EMPLOYEES 2 NAME 2 ADDRESS-LINE(#K:#K+1) END-DEFINE END