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:

File Relation Maintenance Menu

The File Relation Maintenance menu is called with function code M and object code RL in a Predict main menu or the command MAINTAIN FILE RELATION.

13:05:08             *****  P R E D I C T  *****            2007-05-31
Plan   3             - (RL) File relation Maintenance -           Profile HNO

  Function                              Function

  A  Add a File relation                D  Display File relation
  C  Copy File relation                 L  Link children
  M  Modify File relation               S  Select File relation from a list
  N  Rename File relation               
  P  Purge File relation                


Function .........

File relation ID .                                   Attributes.........*
Copy ID ..........
for file ID ......

Restrictions .....*   Profile HNO,used               Association.....*

Command ===>

Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
      Help  Next  Stop  Last  LnkEl Flip  Print Impl  AdmFi SelFi Prof  Main

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

Parameters
Function Executes one of the maintenance functions. All standard maintenance functions are described in the section Maintenance in the Predict Reference documentation.
for file ID For the Select function: a file ID can be specified as an additional selection criterion. Asterisk notation is possible.

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 Screen

The screen below is displayed for the Add a File Relation function. The Copy and Modify screens are similar.

13:30:23             *****  P R E D I C T  *****             2007-05-31
                          - Add a File relation -
File relation ... HNO-RL                                           
Type ...........*                                                  
Keys ..                                                                Zoom: N

Cardinality ..*    :                                               
File 1                                               Minimum ...   
  File ID ....* HNO-FI1                              Average ...   
  Field ID ...* HNO-EL1                              Maximum ...   
File 2                                               Minimum ...   
  File ID ....* HNO-FI2                              Average ...   
  Field ID ...* HNO-EL1                              Maximum ...   
Constraint attributes                                              
  Update type .....*    (none)                                     
  Delete type .....*    (none)                                     
  Constraint name ..      
  Enforce ..........   (Y/N)                                          
Usage ........*    (none)                                          

Abstract     Zoom: N                                               


  Additional attributes ..* N          Associations ..* N

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

Parameters
File Relation The ID of the file relation object.
Type The type of file relation. For a list of valid values, see File Relation Types. See also table in the section Validity Checks for File Relations.
Cardinality
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)
File 1 (File ID, Field ID) 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).
File 2 (File ID, Field ID) 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 File 1 or File 2 in the file relation.
Average The average number of occurrences of a field from File 1 or File 2 in the file relation.
Maximum The maximum number of occurrences of a field from File 1 or File 2 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. Valid values: Y (Enforce) or N..
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.

With Predict retrieval functions, file relations between physical files are treated as though they were connected with the userviews of the files.

File Relation Retrieval

File Relation Specific Retrieval Parameter

using file Restricts the scope of the function to file relations which apply to the specified file. Asterisk notation can be used to specify a range of files.

Layout of File Relation Lists

13:36:22             *****  P R E D I C T  *****             2007-05-31
                           - List File relation -
   
   
---------------------------------------------------------------------------
Cnt  File relation ID                 Type File 1           File 2
   
   1 AER-TST-SYS1-19                    D  AER-TST-SYS1    AER-TST-SYS2
   2 AER-TST-SYS2-18                    D  AER-TST-SYS2    AER-TST-SYS1
   3 AMMM                               D
   4 ARH-RL                             D  ARHTESTCHEN      ARH-BT1
   5 ARH-RL-FUER-BT-FILE                K  ARH-BT1          ARH-BT1
   6 ARH-RL-K                           K  ARH-D1           ARH-D1
   7 ARH-RL1                            D  ARH-123456789012 ARH-123456789012
   8 ARH-RL2                            R  ARH-OT1          ARH-OT1

Meaning of Columns
File Relation ID ID of the file relation object.
Type The type of file relation. See table in the section Validity Checks for File Relations for list of valid types and codes.
File 1 One of the related files.
File 2 The other related file.

Output Options for File Relation Retrieval

The output options valid for this object type are identical to those for object type Dataspace. See Output Options for Dataspace Retrieval.