Version 4.2.6 for Mainframes (Update)
 —  Statements  —

View Definition

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]

A
U
B

[/array-definition] DYNAMIC
redefinition

This document covers the following topics:

For an explanation of the symbols used in the syntax diagram, see Syntax Symbols.


Function

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:

Top of page

Syntax Description

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 (CALL, CALLNAT, RESET, WRITE, etc.), you may specify the group name as a shortcut to reference the fields contained in the group.

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 HISTOGRAM statement, the view must contain only the descriptor for which HISTOGRAM is to be executed.

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:

  1. For Adabas on mainframes, format U is available for LA fields (length <= 16381 bytes), but not for LB fields (length: <= 1 GB).
  2. Format B is not available with Adabas.
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.

Array Definition in a View

Depending on the programming mode used, arrays (periodic-group fields, multiple-value fields) may have to contain information about their occurrences.

Structured Mode

If a field is used in a view that represents an array, the following applies:

Database-Specific Considerations in Structured Mode:

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).

Examples for Structured Mode:

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

Reporting Mode

In this mode, the same rules are valid as for structured mode. However, there are two exceptions:

Examples:

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

Top of page