File Relation

The object type File Relation documents relationships between files. The relationship is established by means of references to fields.

This document covers the following topics:


File Relation Maintenance

The following topics are covered below:

For general information on how to manage objects (for example, how to add or copy an object), see the Predict Object Description documentation.

File Relation Types

The table below contains a list of all valid file relation types.

Code File Relation Type
C Two files of type A are physically coupled.
D The file relation is only documented.
K Common keys. This file relation type is only valid for file types YT and YV (Sybase tables and views). The field linked to the file relation must have a non-blank descriptor type. Predict checks whether the number, formats and character sets of the fields - or source fields in the case of superdescriptors - in file 1 and file 2 agree.
For Sybase, you can generate a common key from a file relation of this type. For other database management systems, file relations of this type are used for documentation purposes only.
N This file relation type documents the models used by Natural Construct. See Defining File Relations for Objects in Predict in the Natural Construct User's documentation.
R Ref. Constraint. Files of type AT, BT, D, JT, OT, X, XT, XV, Y, and YV are connected by referential integrity.
S Files of type A are soft coupled.

Add a File Relation

When you add a file relation, you first have to specify the file relation type in the New Predict Object dialog box.

Select type

When you choose the OK button, a file relation type-specific window appears. The file relation type is indicated in the title bar.

File relation attributes

The parameters listed below can be found on the following tabs: File Relation Attributes, Construct Usage and Constraint Attributes.

Note:
Parameters not listed here are described under Global Attributes.

Parameters
Cardinalities
The number of records of each file that is permitted in any occurrence of the file relation. Valid values:
1 one (must be one)
C none or one (can be one)
CM,CN one or one or more (can be many)
M, N one or more (must be at least one)
Primary File/Field One of the related files. If the type of file relation is R, the field which is used to link this table must be a unique descriptor or ISN (Adabas), a primary index (for DB2) or a unique key (for other SQL systems).
Secondary File/Field The other related file. If the type of file relation is R, the field which is used to link this table must be one of the following:
Minimum The minimum number of occurrences of a field from the primary or secondary file in the file relation.
Average The average number of occurrences of a field from the primary or secondary file in the file relation.
Maximum The maximum number of occurrences of a field from the primary or secondary file in the file relation.
Constraint Attributes
Update type
The type of constraint to be applied.
C Cascade.
R Restricted.
L Suffix as line number (file relation type D or N).
N Renumber suffix (file relation type D or N).
S Set NULL.
D Set Default.
A No Action.
Delete type
The type of constraint to be applied.
C Cascade.
R Restricted.
L Suffix as line number (file relation type D or N).
N Renumber suffix (file relation type D or N).
S Set NULL.
D Set default.
A No Action.
Constraint name The constraint name for a file relation of type D and R. For files of type A, the constraint name must follow the Adabas short name conventions. For details refer to Field Names in Record and Field Definitions of the section Adabas Design in the Adabas Concepts and Facilities documentation.
Enforce Only applicable to file relations of type D or R. Specifies whether or not the referential constraint is enforced by DB2 during normal operations such as insert, update or delete. Check the box to enforce the referential constraint..
Construct Usage
Usage
Only applicable to file relations of type N or D. Describes how the file relation is evaluated in Natural Construct:
A Construct aggregate.
I Construct inheritance.

Validity Checks for File Relations

The validity checks performed by Predict depend on the file relation type:

Code C

Type Applicable for Validity Checks
Physically Coupled Adabas May not be any of the following:
  • redefined field

  • group

  • periodic group

  • member of a periodic group

  • hyperdescriptor

  • phonetic descriptor

The two fields in the file relation must be descriptors with the same length and format.

Code D

Type Applicable for Validity Checks
Documented all types None

Code K

Type Applicable for Validity Checks
Common Keys Sybase tables and views The field linked to the file relation must have a non-blank descriptor type

Code N

Type Applicable for Validity Checks
Natural Construct all types Both the field and file containing the file relation must be defined in Predict.

Code R

Type Applicable for Validity Checks
Referential Constraint

Adabas File
Adabas Cluster Table
DB2 Table
Oracle Table
Adabas D Table
Informix Table or View

Must be marked in the table of file 1:

For file type DB2 table or Informix table/view:
  • as primary index (descriptor type P),

  • foreign index (descr. type F)

  • or index (descr. type D),

  • and as unique (unique option U)

for file type Adabas file:
  • as unique descriptor or ISN;

for file type Adabas cluster table:
  • as primary index (descriptor type P);

for other file types:
  • as unique (unique option U).

Must be marked in the table of file 2:

for file type Adabas file:
  • as descriptor;

For file type Adabas cluster table:
  • as foreign index (descr. type F)

  • or foreign key (descr. type E);

for other file types:
  • as primary index (descr. type P),

  • foreign index (desc. type F)

  • or foreign key (descr. type E).

Code S

Type Applicable for Validity Checks
Soft-coupled Adabas May not be any of the following:
  • redefined field

  • group

  • periodic group

  • member of a periodic group

  • hyperdescriptor

  • phonetic descriptor

The first field in the file relation must be a descriptor; the second field must have the same format.